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

catch all SystemCallErrors.

* lib/fileutils.rb (mkdir_p): catch all SystemCallErrors (mkdir("C:\") causes EACCESS on Windows 2000/NTFS).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2003-12-11 10:54:17 +00:00
parent eb5a174119
commit 5c3abcd043
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Thu Dec 11 19:53:03 2003 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb (mkdir_p): catch all SystemCallErrors.
(mkdir("C:\") causes EACCESS on Windows 2000/NTFS)
Thu Dec 11 19:08:02 2003 Minero Aoki <aamine@loveruby.net> Thu Dec 11 19:08:02 2003 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb (mkdir_p): check if it is a directory after * lib/fileutils.rb (mkdir_p): check if it is a directory after

View file

@ -170,7 +170,7 @@ module FileUtils
return *list if options[:noop] return *list if options[:noop]
mode = options[:mode] || (0777 & ~File.umask) mode = options[:mode] || (0777 & ~File.umask)
list.map {|n| File.expand_path(n) }.each do |path| list.each do |path|
stack = [] stack = []
until path == stack.last # dirname("/")=="/", dirname("C:/")=="C:/" until path == stack.last # dirname("/")=="/", dirname("C:/")=="C:/"
stack.push path stack.push path
@ -179,7 +179,7 @@ module FileUtils
stack.reverse_each do |path| stack.reverse_each do |path|
begin begin
Dir.mkdir path, mode Dir.mkdir path, mode
rescue Errno::EEXIST => err rescue SystemCallError => err
raise unless File.directory?(path) raise unless File.directory?(path)
end end
end end