@echo off setlocal EnableExtensions DisableDelayedExpansion set "REPO_ROOT=%~dp0" if "%REPO_ROOT:~-1%"=="\" set "REPO_ROOT=%REPO_ROOT:~0,-1%" set "SRC_DIR=%REPO_ROOT%\client\release\win-unpacked" set "SRC_EXE=%SRC_DIR%\Planet Earth.exe" if not exist "%SRC_EXE%" ( echo [Planet Earth] Windows unpacked client not found, building via WSL... wsl.exe --cd "%REPO_ROOT%" zsh ./planet.sh bundle --win if errorlevel 1 ( echo [Planet Earth] Build failed. pause exit /b 1 ) ) set "RUN_DIR=%SRC_DIR%" set "RUN_EXE=%SRC_EXE%" if /i "%SRC_DIR:~0,2%"=="\\" ( set "LOCAL_MIRROR=%LOCALAPPDATA%\Planet\client" if not exist "%LOCAL_MIRROR%" mkdir "%LOCAL_MIRROR%" >nul 2>&1 robocopy "%SRC_DIR%" "%LOCAL_MIRROR%" /MIR /FFT /R:2 /W:1 /NJH /NJS /NDL /NP >nul if errorlevel 8 ( echo [Planet Earth] Warning: local mirror sync failed; launching directly from share. ) else ( set "RUN_DIR=%LOCAL_MIRROR%" set "RUN_EXE=%LOCAL_MIRROR%\Planet Earth.exe" ) ) start "" "%RUN_EXE%" %* exit /b 0