22setlocal enabledelayedexpansion
33
44REM 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
66REM Usage:
77REM fetch_bistro_assets.bat [target-dir]
88REM Example:
@@ -12,43 +12,50 @@ set REPO_SSH=git@github.com:gpx1000/bistro.git
1212set REPO_HTTPS = https://github.com/gpx1000/bistro.git
1313
1414if " %~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
2424REM If directory exists and is a git repo, update it; otherwise clone it
2525if 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
5260echo Bistro assets ready at: %TARGET_DIR%
53- endlocal
54- exit /b 0
61+ endlocal & exit /b 0
0 commit comments