Skip to content

Commit 41eaadf

Browse files
committed
Store Windows server data in LocalAppData
1 parent cfaf471 commit 41eaadf

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

build-windows-package.ps1

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,17 @@ cd /d "%~dp0"
141141
142142
set HOST=0.0.0.0
143143
set PORT=8765
144+
set DATA_DIR=%LOCALAPPDATA%\Chatify
145+
set DB_PATH=%DATA_DIR%\chatify.db
144146
145147
if not "%~1"=="" set HOST=%~1
146148
if not "%~2"=="" set PORT=%~2
147149
150+
if not exist "%DATA_DIR%" mkdir "%DATA_DIR%"
151+
148152
echo Starting Chatify server on %HOST%:%PORT%
149-
chatify-server.exe --host %HOST% --port %PORT%
153+
echo Server data: %DATA_DIR%
154+
chatify-server.exe --host %HOST% --port %PORT% --db "%DB_PATH%"
150155
"@
151156

152157
$ClientBat = @"
@@ -173,12 +178,15 @@ cd /d "%~dp0"
173178
174179
set HOST=127.0.0.1
175180
set PORT=8765
181+
set DATA_DIR=%LOCALAPPDATA%\Chatify
182+
set DB_PATH=%DATA_DIR%\chatify.db
176183
177184
if not "%~1"=="" set HOST=%~1
178185
if not "%~2"=="" set PORT=%~2
179186
180187
echo Launching Chatify server and client...
181-
start "Chatify Server" cmd /k "cd /d %~dp0 && chatify-server.exe --host 0.0.0.0 --port %PORT%"
188+
if not exist "%DATA_DIR%" mkdir "%DATA_DIR%"
189+
start "Chatify Server" cmd /k call "%~dp0start-server.bat" 0.0.0.0 %PORT%
182190
timeout /t 1 /nobreak >nul
183191
start "Chatify Client" cmd /k "cd /d %~dp0 && chatify-client.exe --host %HOST% --port %PORT%"
184192
"@
@@ -191,6 +199,8 @@ cd /d "%~dp0"
191199
192200
set DEFAULT_HOST=127.0.0.1
193201
set DEFAULT_PORT=8765
202+
set DATA_DIR=%LOCALAPPDATA%\Chatify
203+
set DB_PATH=%DATA_DIR%\chatify.db
194204
195205
:menu
196206
cls
@@ -217,7 +227,8 @@ set /p PORT=Server port [%DEFAULT_PORT%]:
217227
if "%PORT%"=="" set PORT=%DEFAULT_PORT%
218228
219229
echo Starting server on 0.0.0.0:%PORT%
220-
start "Chatify Server" cmd /k "cd /d %~dp0 && chatify-server.exe --host 0.0.0.0 --port %PORT%"
230+
if not exist "%DATA_DIR%" mkdir "%DATA_DIR%"
231+
start "Chatify Server" cmd /k call "%~dp0start-server.bat" 0.0.0.0 %PORT%
221232
timeout /t 1 /nobreak >nul
222233
223234
echo Connecting local client to 127.0.0.1:%PORT%
@@ -260,6 +271,10 @@ Manual mode:
260271
1) Run start-server.bat
261272
2) Run start-client.bat
262273
274+
Server data:
275+
- The Windows launcher stores server data in %LOCALAPPDATA%\Chatify.
276+
- The database key is written as %LOCALAPPDATA%\Chatify\chatify.db.key.
277+
263278
Optional parameters:
264279
- start-server.bat [host] [port]
265280
- start-client.bat [host] [port]

0 commit comments

Comments
 (0)