-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.bat
More file actions
57 lines (45 loc) · 1.48 KB
/
run.bat
File metadata and controls
57 lines (45 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
if "%1" NEQ "" cd "%1"
cd static
echo. >> error_log.txt
echo --- [ Error log from: %DATE% %TIME% ] --- >> error_log.txt
REM Set PID to first argument
REM It is used to wait for KIRA to end, else patches can't be installed
set PID=%2
REM If PID is empty, just start KIRA
if "%PID%"=="" goto KIRA_START
:KIRA_CHECK
echo Waiting for old KIRA process to stop.
echo Waiting for old KIRA process to stop. >> error_log.txt
REM Search for given PID (of KIRA) in task list
tasklist /FI "PID eq %PID%" 2>NUL | find /I "%PID%">NUL
REM if the PID exists, wait for the programm to finish
if "%ERRORLEVEL%"=="1" ( goto KIRA_ENDED ) else (
echo KIRA is running.
timeout /T 1 /NOBREAK>NUL
goto KIRA_CHECK
)
:KIRA_ENDED
echo Old KIRA process ended.
echo Old KIRA process ended. >> error_log.txt
:INSTALL_PATCH
echo Installing new Patch now...
echo Installing new Patch now...>>error_log.txt
rmdir ..\static_backup\translations /s /q
powershell -command "expand-archive -force patch.zip patch/"
powershell -command "copy-item patch/* -destination .. -force -recurse -verbose"
echo Load static backup...
echo Load static backup...>>error_log.txt
powershell -command "copy-item ../static_backup/* -destination ../static/ -force -recurse -verbose"
rmdir patch /s /q
call npm install
:KIRA_START
node --trace-warnings ..\dist\KIRA.js 2>> error_log.txt
if "%ERRORLEVEL%"=="13" goto END
echo.
echo.
echo Program exited. Please do not close the window if there are any errors.
:LOOP
pause>NUL
goto LOOP
:END