Fixed issue with commented-out user_pref lines

It ended up being a mixture of the previous commit and the fix. It writes a temporary file on the go that only holds preferences, and generates the target file at once at the end. It's slower than before, but it works.
This commit is contained in:
claustromaniac 2017-11-29 16:15:20 +00:00
parent 635cacfe54
commit 3737b65f53

View File

@ -207,9 +207,9 @@ EXIT /B
REM ###### Merge function ######
:merge
DEL /F %2 2>nul
SETLOCAL disabledelayedexpansion
FOR /F "tokens=1,* delims=]" %%G IN ('find /n /v "" ^< "%~1"') DO (
(
FOR /F "tokens=1,* delims=]" %%G IN ('find /n /v "" ^< "%~1"') DO (
SET "_pref=%%H"
SETLOCAL enabledelayedexpansion
SET "_temp=!_pref: =!"
@ -219,7 +219,7 @@ FOR /F "tokens=1,* delims=]" %%G IN ('find /n /v "" ^< "%~1"') DO (
SET "_pref=%%S"
)
SET _pref=!_pref:"=""!
FIND /I "!_pref!" %~2 >nul 2>&1
FIND /I "!_pref!" updatertempfile1 >nul 2>&1
IF ERRORLEVEL 1 (
FOR /F "tokens=* delims=" %%X IN ('FIND /I "!_pref!" %~1') DO (
SET "_temp=%%X"
@ -228,17 +228,19 @@ FOR /F "tokens=1,* delims=]" %%G IN ('find /n /v "" ^< "%~1"') DO (
SET "_pref=%%X"
)
)
ECHO(!_pref!>>%~2
ECHO(!_pref!
ECHO(!_pref!>>updatertempfile1
)
) ELSE (
ECHO(!_pref!>>%~2
ECHO(!_pref!
)
) ELSE (
ECHO(!_pref!>>%~2
ECHO(!_pref!
)
ENDLOCAL
)
)
)>%~2
ENDLOCAL
DEL /F %1 >nul
DEL /F %1 updatertempfile1 >nul
GOTO :EOF
REM ############################