Skip to content

Commit 2187e3f

Browse files
penev92pchote
authored andcommitted
Added an option to run utility.cmd programatically
From OpenRA PR 20010.
1 parent dc11bcd commit 2187e3f

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

utility.cmd

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,32 @@ if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine
1616
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
1717
cd %ENGINE_DIRECTORY%
1818

19+
set argC=0
20+
for %%x in (%*) do set /A argC+=1
21+
22+
if %argC% == 0 goto choosemod
23+
24+
if %argC% == 1 (
25+
set MOD_ID=%1
26+
goto loop
27+
)
28+
29+
if %argC% GEQ 2 (
30+
@REM This option is for use by other scripts so we don't want any extra output here - before or after.
31+
call bin\OpenRA.Utility.exe %*
32+
EXIT /B 0
33+
)
34+
35+
:choosemod
36+
echo ----------------------------------------
37+
echo.
38+
call bin\OpenRA.Utility.exe
39+
echo Enter --exit to exit
40+
set /P mod="Please enter a modname: OpenRA.Utility.exe "
41+
if /I "%mod%" EQU "--exit" (exit /b)
42+
set MOD_ID=%mod%
43+
echo.
44+
1945
:loop
2046
echo.
2147
echo ----------------------------------------
@@ -24,12 +50,12 @@ echo Enter a utility command or --exit to exit.
2450
echo Press enter to view a list of valid utility commands.
2551
echo.
2652

27-
set /P command=Please enter a command: OpenRA.Utility.exe %MOD_ID%
53+
set /P command="Please enter a command: OpenRA.Utility.exe %MOD_ID% "
2854
if /I "%command%" EQU "--exit" (cd %TEMPLATE_DIR% & exit /b)
2955
echo.
3056
echo ----------------------------------------
3157
echo.
32-
echo OpenRA.Utility.exe %MOD_ID% %command%
58+
echo Starting OpenRA.Utility.exe %MOD_ID% %command%
3359
call bin\OpenRA.Utility.exe %MOD_ID% %command%
3460
goto loop
3561

0 commit comments

Comments
 (0)