fix(portable): node-extract path + unreachable legacy-config sync

Two real bugs in the portable launchers:

1. Windows-Install.bat: xcopy reads from %TEMP%\node-<ver>-win-x64
   but Expand-Archive extracts into %TEMP%\node-extract\node-<ver>-win-x64.
   Result: empty runtime\node-win-x64\ on networked install path.

2. Mac-Start.command + Windows-Start.bat: legacy-config sync block
   was placed AFTER the default-config block, so the "config.json
   exists but openclaw.json doesn't" branch was unreachable. Existing
   USB users with config.json never got their settings migrated;
   they got the empty default instead.

Reordered so legacy migration runs first, default only as fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hfshfg
2026-05-01 15:36:34 +08:00
parent 88cf2b2dc4
commit b6ba958b79
3 changed files with 20 additions and 18 deletions

View File

@@ -46,19 +46,20 @@ if not exist "%DATA_DIR%\memory" mkdir "%DATA_DIR%\memory"
if not exist "%DATA_DIR%\backups" mkdir "%DATA_DIR%\backups"
if not exist "%DATA_DIR%\logs" mkdir "%DATA_DIR%\logs"
REM Default config
REM Default config (migrate legacy if present, otherwise create)
if not exist "%STATE_DIR%\openclaw.json" (
echo First run - creating default config...
(echo {"gateway":{"mode":"local","auth":{"token":"uclaw"}}})>"%STATE_DIR%\openclaw.json"
echo Config created
if exist "%DATA_DIR%\config.json" (
echo Migrating legacy config...
copy "%DATA_DIR%\config.json" "%STATE_DIR%\openclaw.json" >nul
echo Config migrated
) else (
echo First run - creating default config...
(echo {"gateway":{"mode":"local","auth":{"token":"uclaw"}}})>"%STATE_DIR%\openclaw.json"
echo Config created
)
echo.
)
REM Sync config from legacy location
if exist "%DATA_DIR%\config.json" if not exist "%STATE_DIR%\openclaw.json" (
copy "%DATA_DIR%\config.json" "%STATE_DIR%\openclaw.json" >nul
)
REM Check dependencies
if not exist "%CORE_DIR%\node_modules" (
echo First run - installing dependencies...