diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-09-10 06:56:20 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-09-10 06:56:20 +0000 |
commit | ed1a776ae06b9b11ae7fe86c94f3a76dae969b41 (patch) | |
tree | b17b25fae7ee9d3440514b9394e6eeb8dd7d36dc | |
parent | 54876834a680d1e57b2176e9f9f3e460b46ea24c (diff) | |
download | ruby-ed1a776ae06b9b11ae7fe86c94f3a76dae969b41.tar.gz |
* lib/fileutils.rb (mkdir_p): should pass mode argument to Dir.mkdir. [ruby-dev:24242]
* test/fileutils/test_fileutils.rb: test it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/fileutils.rb | 2 | ||||
-rw-r--r-- | test/fileutils/test_fileutils.rb | 8 |
3 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,10 @@ +Fri Sep 10 15:55:59 2004 Minero Aoki <aamine@loveruby.net> + + * lib/fileutils.rb (mkdir_p): should pass mode argument to + Dir.mkdir. [ruby-dev:24242] + + * test/fileutils/test_fileutils.rb: test it. + Fri Sep 10 02:43:54 2004 Dave Thomas <dave@pragprog.com> * lib/rdoc/generators/template/kilmer.rb: James Buck's diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 3558ad621b..08e21a07d2 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -180,7 +180,7 @@ module FileUtils list.map {|path| path.sub(%r</\z>, '') }.each do |path| # optimize for the most common case begin - Dir.mkdir path + Dir.mkdir path, mode next rescue SystemCallError next if File.directory?(path) diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index bacbb51aa8..edafcd14e6 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -633,6 +633,14 @@ end assert_equal 0700, (File.stat('tmp/tmp/tmp').mode & 0777) if have_file_perm? rm_rf 'tmp/tmp' + mkdir_p 'tmp/tmp', :mode => 0 + assert_directory 'tmp/tmp' + assert_equal 0, (File.stat('tmp/tmp').mode & 0777) if have_file_perm? + # DO NOT USE rm_rf here. + # (rm(1) try to chdir to parent directory, it fails to remove directory.) + Dir.rmdir 'tmp/tmp' + Dir.rmdir 'tmp' + # pathname assert_nothing_raised { mkdir_p Pathname.new('tmp/tmp/tmp') |