1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/find.rb (Find.find): sort directory entries. [ruby-dev:39847]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-12-13 14:48:54 +00:00
parent f62310ac62
commit c48a4c2936
2 changed files with 17 additions and 16 deletions

View file

@ -1,3 +1,7 @@
Sun Dec 13 23:48:25 2009 Tanaka Akira <akr@fsij.org>
* lib/find.rb (Find.find): sort directory entries. [ruby-dev:39847]
Sun Dec 13 20:55:30 2009 Tanaka Akira <akr@fsij.org>
* test/ruby/envutil.rb (invoke_ruby): call to_str for stdin_data to

View file

@ -46,22 +46,19 @@ module Find
end
begin
if s.directory? then
d = Dir.open(file)
begin
for f in d
next if f == "." or f == ".."
if File::ALT_SEPARATOR and file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then
f = file + f
elsif file == "/" then
f = "/" + f
else
f = File.join(file, f)
end
paths.unshift f.untaint
end
ensure
d.close
end
fs = Dir.entries(file)
fs.sort!
fs.reverse_each {|f|
next if f == "." or f == ".."
if File::ALT_SEPARATOR and file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then
f = file + f
elsif file == "/" then
f = "/" + f
else
f = File.join(file, f)
end
paths.unshift f.untaint
}
end
rescue Errno::ENOENT, Errno::EACCES
end