* lib/fileutils.rb (FileUtils::Entry_::copy): prevent self copy of
directories. * lib/fileutils.rb (FileUtils::fu_each_src_dest0): use try_convert. * lib/fileutils.rb (FileUtils::fu_update_option): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
205d12524c
commit
9a46ab6b62
@ -1,3 +1,12 @@
|
||||
Thu Sep 6 22:57:01 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/fileutils.rb (FileUtils::Entry_::copy): prevent self copy of
|
||||
directories.
|
||||
|
||||
* lib/fileutils.rb (FileUtils::fu_each_src_dest0): use try_convert.
|
||||
|
||||
* lib/fileutils.rb (FileUtils::fu_update_option): ditto.
|
||||
|
||||
Thu Sep 6 21:36:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* include/ruby/oniguruma.h (OnigEncodingTypeST): add end parameter
|
||||
|
@ -1224,6 +1224,9 @@ module FileUtils
|
||||
when file?
|
||||
copy_file dest
|
||||
when directory?
|
||||
if !File.exist?(dest) and /^#{Regexp.quote(path)}/ =~ File.dirname(dest)
|
||||
raise ArgumentError, "cannot copy directory %s to itself %s" % [path, dest]
|
||||
end
|
||||
begin
|
||||
Dir.mkdir dest
|
||||
rescue
|
||||
@ -1392,8 +1395,8 @@ module FileUtils
|
||||
private_module_function :fu_each_src_dest
|
||||
|
||||
def fu_each_src_dest0(src, dest) #:nodoc:
|
||||
if src.is_a?(Array)
|
||||
src.each do |s|
|
||||
if tmp = Array.try_convert(src)
|
||||
tmp.each do |s|
|
||||
s = File.path(s)
|
||||
yield s, File.join(dest, File.basename(s))
|
||||
end
|
||||
@ -1436,8 +1439,8 @@ module FileUtils
|
||||
private_module_function :fu_check_options
|
||||
|
||||
def fu_update_option(args, new) #:nodoc:
|
||||
if args.last.is_a?(Hash)
|
||||
args[-1] = args.last.dup.update(new)
|
||||
if tmp = Hash.try_convert(args.last)
|
||||
args[-1] = tmp.dup.update(new)
|
||||
else
|
||||
args.push new
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user