summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-10 23:13:34 +0200
committerGitHub <noreply@github.com>2021-06-10 23:13:34 +0200
commited3946e295f0e74880d85ffb6f6a933ca87e460d (patch)
tree9974df7701d3258f652d96a83d20592489a6e305 /src/openttd.cpp
parent076f3d26c238a9443b367629ab97dc1a5cf9b931 (diff)
downloadopenttd-ed3946e295f0e74880d85ffb6f6a933ca87e460d.tar.xz
Add: '-X' option to ignore global folders in the search path (#9341)
This is extreme useful for automated testing. Without this, OpenTTD will always look in your personal-dir (like ~/.local/share/openttd or %USER%\Documents\OpenTTD). For most users this is exactly what we want, that there is a shared place for all their files. However, for automated testing this is rather annoying, as your local development files influence the automated test. As such, '-X' counters this, and only gives the local folders. This is especially useful in combination with '-x' and '-c'.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index f39b87c87..fcd8fcd34 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -197,6 +197,7 @@ static void ShowHelp()
" -M music_set = Force the music set (see below)\n"
" -c config_file = Use 'config_file' instead of 'openttd.cfg'\n"
" -x = Never save configuration changes to disk\n"
+ " -X = Don't use global folders to search for files\n"
" -q savegame = Write some information about the savegame and exit\n"
"\n",
lastof(buf)
@@ -506,6 +507,7 @@ static const OptionData _options[] = {
GETOPT_SHORT_VALUE('G'),
GETOPT_SHORT_VALUE('c'),
GETOPT_SHORT_NOVAL('x'),
+ GETOPT_SHORT_NOVAL('X'),
GETOPT_SHORT_VALUE('q'),
GETOPT_SHORT_NOVAL('h'),
GETOPT_END()
@@ -530,6 +532,7 @@ int openttd_main(int argc, char *argv[])
std::unique_ptr<AfterNewGRFScan> scanner(new AfterNewGRFScan());
bool dedicated = false;
char *debuglog_conn = nullptr;
+ bool only_local_path = false;
extern bool _dedicated_forks;
_dedicated_forks = false;
@@ -608,7 +611,7 @@ int openttd_main(int argc, char *argv[])
}
break;
case 'q': {
- DeterminePaths(argv[0]);
+ DeterminePaths(argv[0], only_local_path);
if (StrEmpty(mgo.opt)) {
ret = 1;
return ret;
@@ -637,6 +640,7 @@ int openttd_main(int argc, char *argv[])
case 'G': scanner->generation_seed = strtoul(mgo.opt, nullptr, 10); break;
case 'c': _config_file = mgo.opt; break;
case 'x': scanner->save_config = false; break;
+ case 'X': only_local_path = true; break;
case 'h':
i = -2; // Force printing of help.
break;
@@ -650,7 +654,7 @@ int openttd_main(int argc, char *argv[])
*
* The next two functions are needed to list the graphics sets. We can't do them earlier
* because then we cannot show it on the debug console as that hasn't been configured yet. */
- DeterminePaths(argv[0]);
+ DeterminePaths(argv[0], only_local_path);
TarScanner::DoScan(TarScanner::BASESET);
BaseGraphics::FindSets();
BaseSounds::FindSets();
@@ -659,7 +663,7 @@ int openttd_main(int argc, char *argv[])
return ret;
}
- DeterminePaths(argv[0]);
+ DeterminePaths(argv[0], only_local_path);
TarScanner::DoScan(TarScanner::BASESET);
if (dedicated) DEBUG(net, 3, "Starting dedicated server, version %s", _openttd_revision);