Skip to content

Commit 345b137

Browse files
committed
committing requested changes in stages.
1 parent 8ecae4e commit 345b137

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

attachments/simple_engine/fetch_bistro_assets.bat

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
setlocal enabledelayedexpansion
33

44
REM Fetch the Bistro example assets into the desired assets directory.
5-
REM Default target: assets\bistro at the repository root.
5+
REM Default target when run from attachments\simple_engine: Assets\bistro
66
REM Usage:
77
REM fetch_bistro_assets.bat [target-dir]
88
REM Example:
@@ -12,43 +12,50 @@ set [email protected]:gpx1000/bistro.git
1212
set REPO_HTTPS=https://github.com/gpx1000/bistro.git
1313

1414
if "%~1"=="" (
15-
set TARGET_DIR=Assets\bistro
15+
set "TARGET_DIR=Assets\bistro"
1616
) else (
17-
set TARGET_DIR=%~1
17+
set "TARGET_DIR=%~1"
1818
)
1919

20-
REM Ensure parent directory exists
21-
for %%I in ("%TARGET_DIR%") do set PARENT=%%~dpI
22-
if not exist "%PARENT%" mkdir "%PARENT%"
20+
REM Ensure parent directory exists (avoid trailing backslash quoting issue by appending a dot)
21+
for %%I in ("%TARGET_DIR%") do set "PARENT=%%~dpI"
22+
if not exist "%PARENT%." mkdir "%PARENT%."
2323

2424
REM If directory exists and is a git repo, update it; otherwise clone it
2525
if exist "%TARGET_DIR%\.git" (
2626
echo Updating existing bistro assets in %TARGET_DIR%
27-
pushd "%TARGET_DIR%"
27+
pushd "%TARGET_DIR%" >nul 2>nul
2828
git pull --ff-only
29-
popd
29+
if errorlevel 1 (
30+
echo ERROR: Failed to update repository at %TARGET_DIR%.
31+
popd >nul 2>nul
32+
endlocal & exit /b 1
33+
)
34+
popd >nul 2>nul
3035
) else (
3136
echo Cloning bistro assets into %TARGET_DIR%
3237
REM Try SSH first; fall back to HTTPS on failure
33-
git clone --depth 1 "%REPO_SSH%" "%TARGET_DIR%" 2>nul
34-
if %ERRORLEVEL% neq 0 (
38+
git clone --depth 1 "%REPO_SSH%" "%TARGET_DIR%" 1>nul 2>nul
39+
if errorlevel 1 (
3540
echo SSH clone failed, trying HTTPS
3641
git clone --depth 1 "%REPO_HTTPS%" "%TARGET_DIR%"
42+
if errorlevel 1 (
43+
echo ERROR: Failed to clone repository via HTTPS into %TARGET_DIR%.
44+
endlocal & exit /b 1
45+
)
3746
)
3847
)
3948

40-
REM If git-lfs is available, ensure LFS content is pulled
41-
where git >nul 2>nul
42-
if %ERRORLEVEL%==0 (
43-
pushd "%TARGET_DIR%"
49+
REM If git-lfs is available, ensure LFS content is pulled (ignore failures)
50+
if exist "%TARGET_DIR%\.git" (
51+
pushd "%TARGET_DIR%" >nul 2>nul
4452
git lfs version >nul 2>nul
45-
if %ERRORLEVEL%==0 (
53+
if not errorlevel 1 (
4654
git lfs install --local >nul 2>nul
47-
git lfs pull
55+
git lfs pull || rem ignore
4856
)
49-
popd
57+
popd >nul 2>nul
5058
)
5159

5260
echo Bistro assets ready at: %TARGET_DIR%
53-
endlocal
54-
exit /b 0
61+
endlocal & exit /b 0

0 commit comments

Comments
 (0)