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:
parent
f62310ac62
commit
c48a4c2936
2 changed files with 17 additions and 16 deletions
|
@ -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>
|
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
|
* test/ruby/envutil.rb (invoke_ruby): call to_str for stdin_data to
|
||||||
|
|
29
lib/find.rb
29
lib/find.rb
|
@ -46,22 +46,19 @@ module Find
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
if s.directory? then
|
if s.directory? then
|
||||||
d = Dir.open(file)
|
fs = Dir.entries(file)
|
||||||
begin
|
fs.sort!
|
||||||
for f in d
|
fs.reverse_each {|f|
|
||||||
next if f == "." or f == ".."
|
next if f == "." or f == ".."
|
||||||
if File::ALT_SEPARATOR and file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then
|
if File::ALT_SEPARATOR and file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then
|
||||||
f = file + f
|
f = file + f
|
||||||
elsif file == "/" then
|
elsif file == "/" then
|
||||||
f = "/" + f
|
f = "/" + f
|
||||||
else
|
else
|
||||||
f = File.join(file, f)
|
f = File.join(file, f)
|
||||||
end
|
end
|
||||||
paths.unshift f.untaint
|
paths.unshift f.untaint
|
||||||
end
|
}
|
||||||
ensure
|
|
||||||
d.close
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
rescue Errno::ENOENT, Errno::EACCES
|
rescue Errno::ENOENT, Errno::EACCES
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue