W
Wayne Magor
This was discussed on another thread, but I thought I'd ask the question
here to see if this is a bug or if it should work this way.
This line doesn't seem work from the Windows root directory (C:\) but
works from a subdir.
ruby -e 'puts Dir.glob("/**/*.txt")' # Prints nothing
Here's some commentary from the other thread:
Looks like it behaves oddly at the root:
C:\>irb
irb(main):001:0> Dir.glob( './**/*.rb' ).length
=> 2
irb(main):002:0> Dir.chdir( 'c:/documents and settings/gavin.kistner/
desktop' )
=> 0
irb(main):003:0> Dir.glob( './**/*.rb' ).length
=> 638
irb(main):004:0> Dir.chdir( 'c:/' )
=> 0
irb(main):005:0> Dir.glob( './**/*.rb' ).length
=> 2
irb(main):006:0> Dir.glob( '.\\**\\*.rb' ).length
=> 0
Further evidence, showing that it's not an issue with ** not diving
more than a couple levels deep:
C:\tmp>irb
irb(main):001:0> Dir.glob( './**/*.rb' )
=> ["./l1/l1.rb", "./l1/l2/l2.rb", "./l1/l2/l3/l3.rb", "./l1/l2/l3/l4/
l4.rb"]
irb(main):002:0> Dir.chdir( '..' )
=> 0
irb(main):003:0> Dir.glob( './**/*.rb' )
=> ["./const_alias1.rb", "./const_alias2.rb"]
irb(main):004:0> Dir.glob( 'tmp/**/*.rb' )
=> ["tmp/l1/l1.rb", "tmp/l1/l2/l2.rb", "tmp/l1/l2/l3/l3.rb", "tmp/l1/
l2/l3/l4/l4.rb"]
Smells like a bug to me, but that's a dangerous claim for someone who
hasn't looked at the implementation. Certainly unexpected behavior by
me, too.
here to see if this is a bug or if it should work this way.
This line doesn't seem work from the Windows root directory (C:\) but
works from a subdir.
ruby -e 'puts Dir.glob("/**/*.txt")' # Prints nothing
Here's some commentary from the other thread:
Why doesn't that seem to work for me on Windows? Is there something
different about it on Windows than on Linux?
Is there something different about being at the top-level directory on
Windows? It's unexpected behavior for me. Why does it operate like
that?
Looks like it behaves oddly at the root:
C:\>irb
irb(main):001:0> Dir.glob( './**/*.rb' ).length
=> 2
irb(main):002:0> Dir.chdir( 'c:/documents and settings/gavin.kistner/
desktop' )
=> 0
irb(main):003:0> Dir.glob( './**/*.rb' ).length
=> 638
irb(main):004:0> Dir.chdir( 'c:/' )
=> 0
irb(main):005:0> Dir.glob( './**/*.rb' ).length
=> 2
irb(main):006:0> Dir.glob( '.\\**\\*.rb' ).length
=> 0
Further evidence, showing that it's not an issue with ** not diving
more than a couple levels deep:
C:\tmp>irb
irb(main):001:0> Dir.glob( './**/*.rb' )
=> ["./l1/l1.rb", "./l1/l2/l2.rb", "./l1/l2/l3/l3.rb", "./l1/l2/l3/l4/
l4.rb"]
irb(main):002:0> Dir.chdir( '..' )
=> 0
irb(main):003:0> Dir.glob( './**/*.rb' )
=> ["./const_alias1.rb", "./const_alias2.rb"]
irb(main):004:0> Dir.glob( 'tmp/**/*.rb' )
=> ["tmp/l1/l1.rb", "tmp/l1/l2/l2.rb", "tmp/l1/l2/l3/l3.rb", "tmp/l1/
l2/l3/l4/l4.rb"]
Smells like a bug to me, but that's a dangerous claim for someone who
hasn't looked at the implementation. Certainly unexpected behavior by
me, too.