From e558c374b7975f9923228cdf325f767eef97a725 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 3 Dec 2022 01:28:34 +0900 Subject: downloader.rb: Fix link to absolute cache path --- tool/downloader.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tool/downloader.rb') diff --git a/tool/downloader.rb b/tool/downloader.rb index 3020322a98..59225ecfbd 100644 --- a/tool/downloader.rb +++ b/tool/downloader.rb @@ -64,7 +64,8 @@ class Downloader begin super("https://cdn.jsdelivr.net/gh/gcc-mirror/gcc@master/#{name}", name, *rest) rescue => e - STDERR.puts "Download failed (#{e.message}), try another URL" + m1, m2 = e.message.split("\n", 2) + STDERR.puts "Download failed (#{m1}), try another URL\n#{m2}" super("https://raw.githubusercontent.com/gcc-mirror/gcc/master/#{name}", name, *rest) end else @@ -312,7 +313,16 @@ class Downloader return true if cache.eql?(file) if /cygwin/ !~ RUBY_PLATFORM or /winsymlink:nativestrict/ =~ ENV['CYGWIN'] begin - file.make_symlink(cache.relative_path_from(file.parent)) + link = cache.relative_path_from(file.parent) + rescue ArgumentError + abs = cache.expand_path + link = abs.relative_path_from(file.parent.expand_path) + if link.to_s.size > abs.to_s.size + link = abs + end + end + begin + file.make_symlink(link) rescue SystemCallError else if verbose -- cgit v1.2.1