diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fileutils.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 45ec148bb9..59fc8bbb44 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -917,8 +917,11 @@ module FileUtils private_module_function :apply_mask def symbolic_modes_to_i(mode_sym, path) #:nodoc: - path = File.stat(path) unless File::Stat === path - mode = path.mode + mode = if File::Stat === path + path.mode + else + File.stat(path).mode + end mode_sym.split(/,/).inject(mode & 07777) do |current_mode, clause| target, *actions = clause.split(/([=+-])/) raise ArgumentError, "invalid file mode: #{mode_sym}" if actions.empty? @@ -935,7 +938,7 @@ module FileUtils when "x" mask | 0111 when "X" - if path.directory? + if FileTest.directory? path mask | 0111 else mask |