From facf727e66c0bff926858af8dac7176353c7a639 Mon Sep 17 00:00:00 2001 From: syeopite Date: Mon, 19 Feb 2024 11:44:22 -0800 Subject: [PATCH] Copy dependency file instead of moving them This allows for using the native crystal File.copy function and the caching of downloaded tarballs. --- scripts/fetch-player-dependencies.cr | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/fetch-player-dependencies.cr b/scripts/fetch-player-dependencies.cr index 5acdb293..173e9fbc 100755 --- a/scripts/fetch-player-dependencies.cr +++ b/scripts/fetch-player-dependencies.cr @@ -42,14 +42,15 @@ class Dependency target_path = sprintf(full_target_path, {"file_extension": ".#{extension}"}) end + target_path = Path[target_path] + if download_as = @dependency_config.dig?(YAML::Any.new("install_instructions"), YAML::Any.new("download_as")) destination_path = "#{@destination_path}/#{sprintf(download_as.as_s, {"file_extension": ".#{extension}"})}" else - destination_path = @destination_path + destination_path = Path[@destination_path].join(target_path.basename) end - # https://github.com/crystal-lang/crystal/issues/7777 - `mv #{target_path} #{destination_path}` + File.copy(target_path, destination_path) end private def fetch_path(is_css)