summaryrefslogtreecommitdiff
path: root/src/fileio.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-01-03 11:10:56 +0100
committerGitHub <noreply@github.com>2021-01-03 11:10:56 +0100
commitab7da117e066983d076f540b9722e1b79cf01d98 (patch)
tree7f8008ca41b5156dda975dd90a75d57f4761c24b /src/fileio.cpp
parent8c24b2b6ce7a2049d13132b2657ac3fce6145076 (diff)
downloadopenttd-ab7da117e066983d076f540b9722e1b79cf01d98.tar.xz
Add: always set PERSONAL_DIR "/content_download" in search path (#8481)
This means that if you start OpenTTD with "-c" to indicate another location to store files, it can still read the content you already downloaded from your PERSONAL_DIR. This folder is, however, read-only. This is useful for situations where you downloaded OpenGFX via the content-service, but want to run the regression or want to run with a clean configuration. With this change, you no longer need to download OpenGFX again.
Diffstat (limited to 'src/fileio.cpp')
-rw-r--r--src/fileio.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 44f2cf5c7..9b9a6f5f5 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -1009,17 +1009,24 @@ void DetermineBasePaths(const char *exe)
tmp += PATHSEP;
tmp += PERSONAL_DIR[0] == '.' ? &PERSONAL_DIR[1] : PERSONAL_DIR;
AppendPathSeparator(tmp);
-
_searchpaths[SP_PERSONAL_DIR_XDG] = tmp;
+
+ tmp += "content_download";
+ AppendPathSeparator(tmp);
+ _searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR_XDG] = tmp;
} else if (!homedir.empty()) {
tmp = homedir;
tmp += PATHSEP ".local" PATHSEP "share" PATHSEP;
tmp += PERSONAL_DIR[0] == '.' ? &PERSONAL_DIR[1] : PERSONAL_DIR;
AppendPathSeparator(tmp);
-
_searchpaths[SP_PERSONAL_DIR_XDG] = tmp;
+
+ tmp += "content_download";
+ AppendPathSeparator(tmp);
+ _searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR_XDG] = tmp;
} else {
_searchpaths[SP_PERSONAL_DIR_XDG].clear();
+ _searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR_XDG].clear();
}
#endif
@@ -1031,10 +1038,14 @@ void DetermineBasePaths(const char *exe)
tmp += PATHSEP;
tmp += PERSONAL_DIR;
AppendPathSeparator(tmp);
-
_searchpaths[SP_PERSONAL_DIR] = tmp;
+
+ tmp += "content_download";
+ AppendPathSeparator(tmp);
+ _searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR] = tmp;
} else {
_searchpaths[SP_PERSONAL_DIR].clear();
+ _searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR].clear();
}
#endif