зеркало из https://github.com/github/ruby.git
mkrunnable.rb: try mklink
* tool/mkrunnable.rb (Mswin#ln_safe): try mklink command if not linked already. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c8141a8158
Коммит
759724fa2d
|
@ -19,6 +19,7 @@ module Mswin
|
|||
def ln_safe(src, dest, *opt)
|
||||
cmd = ["mklink", dest.tr("/", "\\"), src.tr("/", "\\")]
|
||||
cmd[1, 0] = opt
|
||||
return if system("cmd", "/c", *cmd)
|
||||
# TODO: use RUNAS or something
|
||||
puts cmd.join(" ")
|
||||
end
|
||||
|
@ -64,12 +65,14 @@ def relative_path_from(path, base)
|
|||
end
|
||||
|
||||
def ln_relative(src, dest)
|
||||
return if File.identical?(src, dest)
|
||||
parent = File.dirname(dest)
|
||||
File.directory?(parent) or mkdir_p(parent)
|
||||
ln_safe(relative_path_from(src, parent), dest)
|
||||
end
|
||||
|
||||
def ln_dir_relative(src, dest)
|
||||
return if File.identical?(src, dest)
|
||||
parent = File.dirname(dest)
|
||||
File.directory?(parent) or mkdir_p(parent)
|
||||
ln_dir_safe(relative_path_from(src, parent), dest)
|
||||
|
|
Загрузка…
Ссылка в новой задаче