Project

General

Profile

Actions

Bug #1005

closed

Strange behaviour of File.directory? under Windows

Added by Dadooda (Alex Fortuna) over 15 years ago. Updated almost 13 years ago.

Status:
Closed
ruby -v:
[ruby-core:21269]

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

Actions #1

Updated by djberg96 (Daniel Berger) over 15 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

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 15 years ago

  • Status changed from Open to Closed
  • Assignee set to nobu (Nobuyoshi Nakada)

=begin
applied at r21447.

=end

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 15 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

Actions #4

Updated by djberg96 (Daniel Berger) over 15 years ago

=begin
I'm not sure, but I believe so.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0