Skip to content

Commit e2129be

Browse files
committed
Add comment support for the options file
also changes its extension to .yaml
1 parent c2e9ce8 commit e2129be

File tree

3 files changed

+46
-19
lines changed

3 files changed

+46
-19
lines changed

BuildMod.bat

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
@echo off
22
setlocal EnableDelayedExpansion
33
set "args="
4-
if not exist options.txt (
5-
echo includeExtraFiles=ask> OPTIONS.txt
6-
echo rebuildMod=ask>> options.txt
7-
echo combine=ask>> options.txt
8-
echo copy=ask>> options.txt
9-
echo updateMBINCompiler=ask>> options.txt
10-
echo checkForConflicts=ask>> options.txt
11-
echo recreatePakList=ask>> options.txt
12-
echo|set /p="recreateMapFileTrees=ask">> options.txt
4+
set "rootPath=%~dp0"
5+
set "optionsFile=!rootPath!\OPTIONS.yaml"
6+
7+
if not exist %optionsFile% (
8+
echo # These are the default options used by BuildMod.bat to build your mods.>%optionsFile%
9+
echo # In each one of them you can either specify a default value or put 'ask'.>> %optionsFile%
10+
echo # Any option with a value of ask will result in the builder to ask you the question during the build process.>> %optionsFile%
11+
echo.>>%optionsFile%
12+
echo # Possible Values:>> %optionsFile%
13+
echo # combine = ask, none, simple, composite, numericSuffix>> %optionsFile%
14+
echo # copy = ask, none, all, some>> %optionsFile%
15+
echo.>>%optionsFile%
16+
echo # All the other options are flags with possible values of: ask, true, false>> %optionsFile%
17+
echo.>>%optionsFile%
18+
echo combine: ask>> %optionsFile%
19+
echo copy: ask>> %optionsFile%
20+
echo includeExtraFiles: ask>> %optionsFile%
21+
echo rebuildMod: ask>> %optionsFile%
22+
echo updateMBINCompiler: ask>> %optionsFile%
23+
echo checkForConflicts: ask>> %optionsFile%
24+
echo recreatePakList: ask>> %optionsFile%
25+
echo|set /p="recreateMapFileTrees: ask">> %optionsFile%
1326
)
14-
for /f "tokens=1,2 delims==" %%G in (options.txt) do (
27+
28+
rem The added space character in `delims=: ` is to support same line comments in the yaml file.
29+
rem As a side effect typing `key value` instead of `key: value` would also work.
30+
rem If we decide to just not support same line comments we should change it to `delims=:`
31+
for /f "tokens=1,2 eol=# delims=: " %%G in (%optionsFile%) do (
1532
set "args=!args!-%%G %%~H "
1633
)
17-
Builder.bat %args%
34+
!rootPath!\Builder.bat %args%

OPTIONS.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

OPTIONS.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# These are the default options used by BuildMod.bat to build your mods.
2+
# In each one of them you can either specify a default value or put 'ask'.
3+
# Any option with a value of ask will result in the builder to ask you the question during the build process.
4+
5+
# Possible Values:
6+
# combine = ask, none, simple, composite, numericSuffix
7+
# copy = ask, none, all, some
8+
9+
# All the other options are flags with possible values of: ask, true, false
10+
11+
combine: ask
12+
copy: ask
13+
includeExtraFiles: ask
14+
rebuildMod: ask
15+
updateMBINCompiler: ask
16+
checkForConflicts: ask
17+
recreatePakList: ask
18+
recreateMapFileTrees: ask

0 commit comments

Comments
 (0)