mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 05:29:10 +02:00
[ruby/fileutils] Just the parent path of the destination symlink should exist
71225b1b46
This commit is contained in:
parent
4431ca5363
commit
5a8e87cb2e
2 changed files with 6 additions and 2 deletions
|
@ -739,7 +739,7 @@ module FileUtils
|
|||
real_ddirs = fu_split_path(File.realpath(parent))
|
||||
else
|
||||
destdirs ||= fu_split_path(dest)
|
||||
real_ddirs ||= fu_split_path(File.realpath(dest))
|
||||
real_ddirs ||= fu_split_path(File.realdirpath(dest))
|
||||
end
|
||||
srcdirs = fu_split_path(s)
|
||||
i = fu_common_components(srcdirs, destdirs)
|
||||
|
|
|
@ -1080,7 +1080,11 @@ class TestFileUtils < Test::Unit::TestCase
|
|||
assert_raise(Errno::EEXIST, Errno::EACCES) {
|
||||
ln_sr fname, 'tmp', target_directory: false
|
||||
}
|
||||
assert_file.not_exist? File.join('tmp/', File.basename(fname))
|
||||
dest = File.join('tmp/', File.basename(fname))
|
||||
assert_file.not_exist? dest
|
||||
ln_sr fname, dest, target_directory: false
|
||||
assert_file.symlink?(dest)
|
||||
assert_equal("../#{fname}", File.readlink(dest))
|
||||
end
|
||||
end if have_symlink?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue