Bug #1005
closedStrange behaviour of File.directory? under Windows
Description
=begin
Under Windows:
C:>ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32]
C:>irb
irb(main):001:0> File.directory? ".."
=> true
irb(main):002:0> File.directory? "..."
=> true
irb(main):003:0> File.directory? ".............."
=> true
Under Unix:
ruby --version¶
ruby 1.8.5 (2006-08-25) [i386-linux]
irb¶
irb(main):001:0> File.directory? ".."
=> true
irb(main):002:0> File.directory? "..."
=> false
irb(main):003:0> File.directory? "........"
=> false
I.e. it looks like File.directory? returns true under Windows if filename contains any number of dots.
Sorry, could'n test this exact Ruby version under Unix.
=end
Updated by djberg96 (Daniel Berger) almost 16 years ago
=begin
If it's a bug, it's a bug in the Windows API:
irb(main):001:0> require 'windows/path'
=> true
irb(main):002:0> include Windows::Path
=> Object
irb(main):003:0> PathIsDirectory('.')
=> true
irb(main):004:0> PathIsDirectory('..')
=> true
irb(main):005:0> PathIsDirectory('...')
=> true
irb(main):006:0> PathIsDirectory('.......')
=> true
=end
Updated by nobu (Nobuyoshi Nakada) almost 16 years ago
- Status changed from Open to Closed
- Assignee set to nobu (Nobuyoshi Nakada)
=begin
applied at r21447.
=end
Updated by nobu (Nobuyoshi Nakada) almost 16 years ago
=begin
Hi,
At Tue, 13 Jan 2009 01:12:27 +0900,
Daniel Berger wrote in [ruby-core:21278]:
If it's a bug, it's a bug in the Windows API:
irb(main):001:0> require 'windows/path'
=> true
irb(main):002:0> include Windows::Path
=> Object
irb(main):003:0> PathIsDirectory('.')
=> true
irb(main):004:0> PathIsDirectory('..')
=> true
irb(main):005:0> PathIsDirectory('...')
=> true
irb(main):006:0> PathIsDirectory('.......')
=> true
What API does the PathIsDirectory method use,
GetFileAttributes()?
--
Nobu Nakada
=end
Updated by djberg96 (Daniel Berger) almost 16 years ago
=begin
I'm not sure, but I believe so.
=end