* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a3dde7df52
commit
3a2f5d9cf7
@ -1,4 +1,11 @@
|
|||||||
Mon Apr 12 09:18:53 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Apr 12 09:19:49 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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
|
* lib/fileutils.rb (fu_have_st_ino): check if required method is
|
||||||
defined, instead of platform name.
|
defined, instead of platform name.
|
||||||
|
@ -840,10 +840,9 @@ module FileUtils
|
|||||||
fu_check_options options, OPT_TABLE['install']
|
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]
|
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]
|
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)
|
unless File.exist?(d) and compare_file(s, d)
|
||||||
remove_file d, true
|
remove_file d, true
|
||||||
st = File.stat(s) if options[:preserve]
|
|
||||||
copy_file s, d
|
copy_file s, d
|
||||||
File.utime st.atime, st.mtime, d if options[:preserve]
|
File.utime st.atime, st.mtime, d if options[:preserve]
|
||||||
File.chmod options[:mode], d if options[:mode]
|
File.chmod options[:mode], d if options[:mode]
|
||||||
@ -1401,7 +1400,7 @@ module FileUtils
|
|||||||
def fu_each_src_dest(src, dest) #:nodoc:
|
def fu_each_src_dest(src, dest) #:nodoc:
|
||||||
fu_each_src_dest0(src, dest) do |s, d|
|
fu_each_src_dest0(src, dest) do |s, d|
|
||||||
raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(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
|
||||||
end
|
end
|
||||||
private_module_function :fu_each_src_dest
|
private_module_function :fu_each_src_dest
|
||||||
@ -1424,23 +1423,10 @@ module FileUtils
|
|||||||
private_module_function :fu_each_src_dest0
|
private_module_function :fu_each_src_dest0
|
||||||
|
|
||||||
def fu_same?(a, b) #:nodoc:
|
def fu_same?(a, b) #:nodoc:
|
||||||
if fu_have_st_ino?
|
File.identical?(a, b)
|
||||||
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
|
|
||||||
end
|
end
|
||||||
private_module_function :fu_same?
|
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:
|
def fu_check_options(options, optdecl) #:nodoc:
|
||||||
h = options.dup
|
h = options.dup
|
||||||
optdecl.each do |opt|
|
optdecl.each do |opt|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user