extlibs.rb: make symlink only if the target exists

This commit is contained in:
Nobuyoshi Nakada 2020-05-23 14:56:13 +09:00
parent 3015a7aae7
commit 0b2fc4cf37
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6

View File

@ -99,6 +99,7 @@ class ExtLibs
if (target = src).start_with?("/")
target = File.join([".."] * file.count("/"), src)
end
return unless File.exist?(File.expand_path(target, File.dirname(file)))
File.unlink(file) rescue nil
begin
File.symlink(target, file)