From f241e9e09a17f35e34f5653c5a0603a4448bf2aa Mon Sep 17 00:00:00 2001 From: Boris Basic <boris.basic@edf.fr> Date: Thu, 12 Oct 2023 12:56:54 +0200 Subject: [PATCH] Prompt to delete the installation folder if it already exists --- build-telemac.bat | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/build-telemac.bat b/build-telemac.bat index df39bcb..1f085a9 100644 --- a/build-telemac.bat +++ b/build-telemac.bat @@ -130,10 +130,25 @@ if %errorlevel% == 1 ( ) rem ************* -rem Clone Telemac +rem Clone Telemac rem ************* -rd /s/q %install_path% 2>nul -git clone -b %version% https://gitlab.pam-retd.fr/otm/telemac-mascaret.git %install_path% || exit /b 0 +set clone=n +if exist %install_path% ( + set /p clone=""%install_path%" already exists, do yo want to remove it (y[n])? " +) else ( + set clone=y +) +if /i "%clone%" equ "y" ( + rd /s/q %install_path% 2>nul + git clone -b %version% https://gitlab.pam-retd.fr/otm/telemac-mascaret.git %install_path% || exit /b 0 +) else ( + pushd %install_path% + echo Switching to %version% branch... + git switch %version% || exit /b 0 + echo Updating %version% branch... + git pull --rebase || exit /b 0 + popd +) rem ********************** rem Build the dependencies -- GitLab