From 1e1390452e8c04e9421ea99d56125b4e3f9f907f Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Fri, 3 Mar 2023 14:38:59 -0500 Subject: [PATCH] Update hermes-utils.rb --- sdks/hermes-engine/hermes-utils.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sdks/hermes-engine/hermes-utils.rb b/sdks/hermes-engine/hermes-utils.rb index 4098b2071d0ca2..06f36447d50adc 100644 --- a/sdks/hermes-engine/hermes-utils.rb +++ b/sdks/hermes-engine/hermes-utils.rb @@ -110,9 +110,13 @@ def download_nightly_hermes(react_native_path, version) tarball_url = nightly_tarball_url(version) destination_folder = "#{react_native_path}/sdks/downloads" - destination_path = "#{destination_folder}/hermes-ios.tar.gz" + destination_path = "#{destination_folder}/hermes-ios-#{version}.tar.gz" - `mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{destination_path}"` + unless File.exist?(destination_path) + # Download to a temporary file first so we don't cache incomplete downloads. + tmp_file = "#{destination_folder}/hermes-ios.download" + `mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"` + end return destination_path end