mirror of
https://github.com/arkenfox/user.js.git
synced 2025-02-23 19:03:56 +00:00
2nd merge optimisation
While I figure out a fix for the missing characters... Enclosing the whole merging loop in parentheses and replacing the source file with the entire output at once is more efficient than appending individual lines with >>%~2. The script doesn't have to wait for the HD to continue processing.
This commit is contained in:
parent
ff9370b714
commit
c9e7f1ccfa
53
updater.bat
53
updater.bat
@ -39,7 +39,7 @@ IF DEFINED _updateb (
|
|||||||
IF NOT "!_myname:~0,9!"=="[updated]" (
|
IF NOT "!_myname:~0,9!"=="[updated]" (
|
||||||
ECHO Checking updater version...
|
ECHO Checking updater version...
|
||||||
ECHO.
|
ECHO.
|
||||||
DEL /F "[updated]!_myname!.bat" 2>nul
|
IF EXIST "[updated]!_myname!.bat" ( DEL /F "[updated]!_myname!.bat" )
|
||||||
REM Uncomment the next line and comment the powershell call for testing.
|
REM Uncomment the next line and comment the powershell call for testing.
|
||||||
REM COPY /B /V /Y "!_myname!.bat" "[updated]!_myname!.bat"
|
REM COPY /B /V /Y "!_myname!.bat" "[updated]!_myname!.bat"
|
||||||
(
|
(
|
||||||
@ -207,37 +207,38 @@ EXIT /B
|
|||||||
|
|
||||||
REM ###### Merge function ######
|
REM ###### Merge function ######
|
||||||
:merge
|
:merge
|
||||||
DEL /F %2 2>nul
|
|
||||||
SETLOCAL disabledelayedexpansion
|
SETLOCAL disabledelayedexpansion
|
||||||
FOR /F "tokens=1,* delims=]" %%G IN ('find /n /v "" ^< "%~1"') DO (
|
(
|
||||||
SET "_pref=%%H"
|
FOR /F "tokens=1,* delims=]" %%G IN ('find /n /v "" ^< "%~1"') DO (
|
||||||
SETLOCAL enabledelayedexpansion
|
SET "_pref=%%H"
|
||||||
SET "_temp=!_pref: =!"
|
SETLOCAL enabledelayedexpansion
|
||||||
IF /I "user_pref"=="!_temp:~0,9!" (
|
SET "_temp=!_pref: =!"
|
||||||
IF /I NOT "user.js.parrot"=="!_temp:~12,14!" (
|
IF /I "user_pref"=="!_temp:~0,9!" (
|
||||||
FOR /F "delims=," %%S IN ("!_pref!") DO (
|
IF /I NOT "user.js.parrot"=="!_temp:~12,14!" (
|
||||||
SET "_pref=%%S"
|
FOR /F "delims=," %%S IN ("!_pref!") DO (
|
||||||
)
|
SET "_pref=%%S"
|
||||||
SET _pref=!_pref:"=""!
|
|
||||||
FIND /I "!_pref!" %~2 >nul 2>&1
|
|
||||||
IF ERRORLEVEL 1 (
|
|
||||||
FOR /F "tokens=* delims=" %%X IN ('FIND /I "!_pref!" %~1') DO (
|
|
||||||
SET "_temp=%%X"
|
|
||||||
SET "_temp=!_temp: =!"
|
|
||||||
IF /I "user_pref"=="!_temp:~0,9!" (
|
|
||||||
SET "_pref=%%X"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
ECHO(!_pref!>>%~2
|
SET _pref=!_pref:"=""!
|
||||||
|
FIND /I "!_pref!" %~2 >nul 2>&1
|
||||||
|
IF ERRORLEVEL 1 (
|
||||||
|
FOR /F "tokens=* delims=" %%X IN ('FIND /I "!_pref!" %~1') DO (
|
||||||
|
SET "_temp=%%X"
|
||||||
|
SET "_temp=!_temp: =!"
|
||||||
|
IF /I "user_pref"=="!_temp:~0,9!" (
|
||||||
|
SET "_pref=%%X"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
ECHO(!_pref!
|
||||||
|
)
|
||||||
|
) ELSE (
|
||||||
|
ECHO(!_pref!
|
||||||
)
|
)
|
||||||
) ELSE (
|
) ELSE (
|
||||||
ECHO(!_pref!>>%~2
|
ECHO(!_pref!
|
||||||
)
|
)
|
||||||
) ELSE (
|
ENDLOCAL
|
||||||
ECHO(!_pref!>>%~2
|
|
||||||
)
|
)
|
||||||
ENDLOCAL
|
)>%~2
|
||||||
)
|
|
||||||
ENDLOCAL
|
ENDLOCAL
|
||||||
DEL /F %1 >nul
|
DEL /F %1 >nul
|
||||||
GOTO :EOF
|
GOTO :EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user