Paul Brannan
10/8/2004 2:47:00 AM
If a file is unreadable on Linux, Find.find seems to skip it and move to
the next file.
However, if a file is unreadable on Windows, Find.find seems to raise an
exception, and I see no way to go to the next file:
C:\temp>ruby -e 'puts RUBY_VERSION'
1.8.1
C:\temp>mkdir foo bar baz
C:\temp>echo > bar\file1.txt
C:\temp>echo > baz\file2.txt
C:\temp>echo > foo\file3.txt
C:\temp>ruby -rfind -e "Find.find('.') { |f| p f }"
"."
"./foo"
"./foo/file3.txt"
"./baz"
"./baz/file2.txt"
"./bar"
"./bar/file1.txt"
(now I remove the read privilege from the baz directory using Windows
Explorer)
C:\temp>ruby -rfind -e "Find.find('.') { |f| p f }"
"."
"./foo"
"./foo/file3.txt"
"./baz"
c:/ruby/lib/ruby/1.8/find.rb:42:in `open': Invalid argument - ./baz (Errno::EINVAL)
from c:/ruby/lib/ruby/1.8/find.rb:42:in `find'
from c:/ruby/lib/ruby/1.8/find.rb:38:in `catch'
from c:/ruby/lib/ruby/1.8/find.rb:38:in `find'
from -e:1
Is this a bug? Is there a workaround?
Paul