From 32d248a09f64e0990ce20face2da100e75a109e3 Mon Sep 17 00:00:00 2001 From: Draqoken <67341000+audioses@users.noreply.github.com> Date: Wed, 23 Apr 2025 12:41:02 +0300 Subject: [PATCH] Update updator.bat --- updator.bat | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/updator.bat b/updator.bat index ec059c1..d28d2f5 100644 --- a/updator.bat +++ b/updator.bat @@ -21,17 +21,25 @@ echo [%DATE% %TIME%] Main repository directory: %MAIN_REPO_DIR% >> "%LOG_FILE%" echo [%DATE% %TIME%] Sounds directory: %SOUNDS_DIR% >> "%LOG_FILE%" echo [%DATE% %TIME%] Temporary scripts directory: %SCRIPTS_TEMP_DIR% >> "%LOG_FILE%" -:: --------- Check GitPortable Exists --------- -if not exist "%GIT_PORTABLE%" ( - echo [%DATE% %TIME%] ERROR: GitPortable not found at %GIT_PORTABLE% >> "%LOG_FILE%" - echo ERROR: GitPortable not found. +:: --------- Determine which Git to use --------- +set "GIT_CMD=" +where git >nul 2>nul +if %errorlevel%==0 ( + set "GIT_CMD=git" + echo [%DATE% %TIME%] Git found in PATH. >> "%LOG_FILE%" +) else if exist "%GIT_PORTABLE%" ( + set "GIT_CMD=%GIT_PORTABLE%" + echo [%DATE% %TIME%] Git not found in PATH, using GitPortable. >> "%LOG_FILE%" +) else ( + echo [%DATE% %TIME%] ERROR: Git not found in PATH or at %GIT_PORTABLE% >> "%LOG_FILE%" + echo ERROR: Git not found in PATH or at %GIT_PORTABLE% pause exit /b ) :: --------- Attempt to Pull from Main Repo or Clone if Failed --------- echo [%DATE% %TIME%] Attempting to pull updates from the main repo... >> "%LOG_FILE%" -"%GIT_PORTABLE%" -C "%MAIN_REPO_DIR%" pull >> "%LOG_FILE%" 2>&1 +%GIT_CMD% -C "%MAIN_REPO_DIR%" pull >> "%LOG_FILE%" 2>&1 if errorlevel 1 ( echo [%DATE% %TIME%] ERROR: Git pull failed. Cloning repo instead... >> "%LOG_FILE%" goto clone_repo @@ -47,7 +55,7 @@ if exist "%SCRIPTS_TEMP_DIR%" ( rd /s /q "%SCRIPTS_TEMP_DIR%" >nul 2>&1 ) echo [%DATE% %TIME%] Cloning main repo into temporary directory... >> "%LOG_FILE%" -"%GIT_PORTABLE%" clone "%SCRIPTS_REPO_URL%" "%SCRIPTS_TEMP_DIR%" >> "%LOG_FILE%" 2>&1 +"%GIT_CMD%" clone "%SCRIPTS_REPO_URL%" "%SCRIPTS_TEMP_DIR%" >> "%LOG_FILE%" if errorlevel 1 ( echo [%DATE% %TIME%] ERROR: Git clone failed for main scripts repo. >> "%LOG_FILE%" echo ERROR: Failed to clone the main scripts repo. Check network or GitPortable version. @@ -85,7 +93,7 @@ rd /s /q "%SCRIPTS_TEMP_DIR%" >nul 2>&1 :: --------- Pull Updates for Sounds Repo --------- if exist "%SOUNDS_DIR%" ( echo [%DATE% %TIME%] Pulling updates for the sounds repository... >> "%LOG_FILE%" - "%GIT_PORTABLE%" -C "%SOUNDS_DIR%" pull >> "%LOG_FILE%" 2>&1 + "%GIT_CMD%" -C "%SOUNDS_DIR%" pull >> "%LOG_FILE%" if errorlevel 1 ( echo [%DATE% %TIME%] ERROR: Failed to pull updates for the sounds repository. >> "%LOG_FILE%" echo ERROR: Failed to pull updates for the sounds repository. Check the log for details.