Skip to content

Commit 09d620c

Browse files
committed
🆕 Added config file version checking
This is ahead of upcoming features which may require the config file to be updated
1 parent 7289ec3 commit 09d620c

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

START.bat

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@echo off
22
title Checking dependencies...
33
set scriptVersion=v1.2.2
4+
set currentConfigVersion=v1.2.2
45

56
REM Set restart counter variables
67
set "restartCount=0"
@@ -16,7 +17,24 @@ REM Check if script config file exists, if not, go to create it.
1617
if not exist .\config\StartupScript.conf (
1718
goto initialSetup
1819
) else (
19-
goto scriptUpdater
20+
REM Check configuration version
21+
set "configVersion="
22+
for /f "tokens=1,* delims==" %%a in ('type .\config\StartupScript.conf') do (
23+
if "%%a"=="configVersion" (
24+
set "configVersion=%%b"
25+
goto configVersionFound
26+
)
27+
)
28+
:configVersionFound
29+
REM Compare with expected version
30+
if "%configVersion%" NEQ "%currentConfigVersion%" (
31+
echo Following an update, your configuration file is outdated.
32+
echo Press any key to update your configuration...
33+
pause >nul
34+
goto initialSetup
35+
) else (
36+
goto scriptUpdater
37+
)
2038
)
2139

2240
:scriptUpdater
@@ -208,7 +226,9 @@ if %errorlevel%==2 goto initialSetup
208226

209227
:saveSetup
210228
title Saving setup...
211-
echo # > .\config\StartupScript.conf
229+
echo # Configuration File Version > .\config\StartupScript.conf
230+
echo configVersion=%currentConfigVersion%>> .\config\StartupScript.conf
231+
echo # >> .\config\StartupScript.conf
212232
echo # --------------------------------------------------------------------------------------------------------------------------- >> .\config\StartupScript.conf
213233
echo # Change the values in the section below >> .\config\StartupScript.conf
214234
echo # --------------------------------------------------------------------------------------------------------------------------- >> .\config\StartupScript.conf

0 commit comments

Comments
 (0)