generated from OpenRA/OpenRAModSDK
-
Notifications
You must be signed in to change notification settings - Fork 1
/
utility.cmd
executable file
·73 lines (61 loc) · 1.92 KB
/
utility.cmd
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@echo off
setlocal EnableDelayedExpansion
FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B)
if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B))
set MOD_SEARCH_PATHS=%~dp0mods,./mods
set ENGINE_DIR=..
if "!MOD_ID!" == "" goto badconfig
if "!ENGINE_VERSION!" == "" goto badconfig
if "!ENGINE_DIRECTORY!" == "" goto badconfig
title OpenRA.Utility.exe %MOD_ID%
set TEMPLATE_DIR=%CD%
if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
cd %ENGINE_DIRECTORY%
set argC=0
for %%x in (%*) do set /A argC+=1
if %argC% == 0 goto choosemod
if %argC% == 1 (
set MOD_ID=%1
goto loop
)
if %argC% GEQ 2 (
@REM This option is for use by other scripts so we don't want any extra output here - before or after.
call bin\OpenRA.Utility.exe %*
EXIT /B 0
)
:choosemod
echo ----------------------------------------
echo.
call bin\OpenRA.Utility.exe
echo Enter --exit to exit
set /P mod="Please enter a modname: OpenRA.Utility.exe "
if /I "%mod%" EQU "--exit" (exit /b)
set MOD_ID=%mod%
echo.
:loop
echo.
echo ----------------------------------------
echo.
echo Enter a utility command or --exit to exit.
echo Press enter to view a list of valid utility commands.
echo.
set /P command="Please enter a command: OpenRA.Utility.exe %MOD_ID% "
if /I "%command%" EQU "--exit" (cd %TEMPLATE_DIR% & exit /b)
echo.
echo ----------------------------------------
echo.
echo Starting OpenRA.Utility.exe %MOD_ID% %command%
call bin\OpenRA.Utility.exe %MOD_ID% %command%
goto loop
:noengine
echo Required engine files not found.
echo Run `make all` in the mod directory to fetch and build the required files, then try again.
pause
exit /b
:badconfig
echo Required mod.config variables are missing.
echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are
echo defined in your mod.config (or user.config) and try again.
pause
exit /b