From 89cfc58ab27c3668a5c68a1122776895d4b176d8 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Fri, 18 Aug 2023 19:54:01 +0200 Subject: [PATCH] fix(foundryup): check if file exists before moving --- foundryup/foundryup | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/foundryup/foundryup b/foundryup/foundryup index 4ea420ecc39b6..af0d4d52c2c6a 100755 --- a/foundryup/foundryup +++ b/foundryup/foundryup @@ -206,7 +206,12 @@ EOF # Build the repo and install the binaries locally to the .foundry bin directory. ensure cargo build --bins --release for bin in "${BINS[@]}"; do - mv -f "target/release/$bin" "target/release/$bin.exe" "$FOUNDRY_DIR" + for try_path in target/release/$bin target/release/$bin.exe; do + if [ -f "$try_path" ]; then + [ -e "$FOUNDRY_BIN_DIR/$bin" ] && warn "overwriting existing $bin in $FOUNDRY_BIN_DIR" + mv -f "$try_path" "$FOUNDRY_BIN_DIR" + fi + done done # If help2man is installed, use it to add Foundry man pages.