ruby-changes:15421
From: nobu <ko1@a...>
Date: Mon, 12 Apr 2010 09:20:50 +0900 (JST)
Subject: [ruby-changes:15421] Ruby:r27317 (trunk): * lib/fileutils.rb (fu_each_src_dest): ensure src is accessible.
nobu 2010-04-12 09:19:52 +0900 (Mon, 12 Apr 2010) New Revision: 27317 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27317 Log: * lib/fileutils.rb (fu_each_src_dest): ensure src is accessible. * lib/fileutils.rb (fu_same): use File.identical? to get rid of exceptions. [ruby-core:28141] * lib/fileutils.rb (fu_have_st_ino): no longer used. Modified files: trunk/ChangeLog trunk/lib/fileutils.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 27316) +++ ChangeLog (revision 27317) @@ -1,5 +1,12 @@ -Mon Apr 12 09:18:53 2010 Nobuyoshi Nakada <nobu@r...> +Mon Apr 12 09:19:49 2010 Nobuyoshi Nakada <nobu@r...> + * lib/fileutils.rb (fu_each_src_dest): ensure src is accessible. + + * lib/fileutils.rb (fu_same): use File.identical? to get rid of + exceptions. [ruby-core:28141] + + * lib/fileutils.rb (fu_have_st_ino): no longer used. + * lib/fileutils.rb (fu_have_st_ino): check if required method is defined, instead of platform name. Index: lib/fileutils.rb =================================================================== --- lib/fileutils.rb (revision 27316) +++ lib/fileutils.rb (revision 27317) @@ -840,10 +840,9 @@ fu_check_options options, OPT_TABLE['install'] fu_output_message "install -c#{options[:preserve] && ' -p'}#{options[:mode] ? (' -m 0%o' % options[:mode]) : ''} #{[src,dest].flatten.join ' '}" if options[:verbose] return if options[:noop] - fu_each_src_dest(src, dest) do |s, d| + fu_each_src_dest(src, dest) do |s, d, st| unless File.exist?(d) and compare_file(s, d) remove_file d, true - st = File.stat(s) if options[:preserve] copy_file s, d File.utime st.atime, st.mtime, d if options[:preserve] File.chmod options[:mode], d if options[:mode] @@ -1401,7 +1400,7 @@ def fu_each_src_dest(src, dest) #:nodoc: fu_each_src_dest0(src, dest) do |s, d| raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(s, d) - yield s, d + yield s, d, File.stat(s) end end private_module_function :fu_each_src_dest @@ -1424,23 +1423,10 @@ private_module_function :fu_each_src_dest0 def fu_same?(a, b) #:nodoc: - if fu_have_st_ino? - st1 = File.stat(a) - st2 = File.stat(b) - st1.dev == st2.dev and st1.ino == st2.ino - else - File.expand_path(a) == File.expand_path(b) - end - rescue Errno::ENOENT - return false + File.identical?(a, b) end private_module_function :fu_same? - def fu_have_st_ino? #:nodoc: - File::Stat.method_defined?(:ino) - end - private_module_function :fu_have_st_ino? - def fu_check_options(options, optdecl) #:nodoc: h = options.dup optdecl.each do |opt| -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/