mirror of https://github.com/OpenTTD/OpenTTD
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.pull/8486/head
parent
8c24b2b6ce
commit
ab7da117e0
|
@ -1009,17 +1009,24 @@ void DetermineBasePaths(const char *exe)
|
||||||
tmp += PATHSEP;
|
tmp += PATHSEP;
|
||||||
tmp += PERSONAL_DIR[0] == '.' ? &PERSONAL_DIR[1] : PERSONAL_DIR;
|
tmp += PERSONAL_DIR[0] == '.' ? &PERSONAL_DIR[1] : PERSONAL_DIR;
|
||||||
AppendPathSeparator(tmp);
|
AppendPathSeparator(tmp);
|
||||||
|
|
||||||
_searchpaths[SP_PERSONAL_DIR_XDG] = tmp;
|
_searchpaths[SP_PERSONAL_DIR_XDG] = tmp;
|
||||||
|
|
||||||
|
tmp += "content_download";
|
||||||
|
AppendPathSeparator(tmp);
|
||||||
|
_searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR_XDG] = tmp;
|
||||||
} else if (!homedir.empty()) {
|
} else if (!homedir.empty()) {
|
||||||
tmp = homedir;
|
tmp = homedir;
|
||||||
tmp += PATHSEP ".local" PATHSEP "share" PATHSEP;
|
tmp += PATHSEP ".local" PATHSEP "share" PATHSEP;
|
||||||
tmp += PERSONAL_DIR[0] == '.' ? &PERSONAL_DIR[1] : PERSONAL_DIR;
|
tmp += PERSONAL_DIR[0] == '.' ? &PERSONAL_DIR[1] : PERSONAL_DIR;
|
||||||
AppendPathSeparator(tmp);
|
AppendPathSeparator(tmp);
|
||||||
|
|
||||||
_searchpaths[SP_PERSONAL_DIR_XDG] = tmp;
|
_searchpaths[SP_PERSONAL_DIR_XDG] = tmp;
|
||||||
|
|
||||||
|
tmp += "content_download";
|
||||||
|
AppendPathSeparator(tmp);
|
||||||
|
_searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR_XDG] = tmp;
|
||||||
} else {
|
} else {
|
||||||
_searchpaths[SP_PERSONAL_DIR_XDG].clear();
|
_searchpaths[SP_PERSONAL_DIR_XDG].clear();
|
||||||
|
_searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR_XDG].clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1031,10 +1038,14 @@ void DetermineBasePaths(const char *exe)
|
||||||
tmp += PATHSEP;
|
tmp += PATHSEP;
|
||||||
tmp += PERSONAL_DIR;
|
tmp += PERSONAL_DIR;
|
||||||
AppendPathSeparator(tmp);
|
AppendPathSeparator(tmp);
|
||||||
|
|
||||||
_searchpaths[SP_PERSONAL_DIR] = tmp;
|
_searchpaths[SP_PERSONAL_DIR] = tmp;
|
||||||
|
|
||||||
|
tmp += "content_download";
|
||||||
|
AppendPathSeparator(tmp);
|
||||||
|
_searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR] = tmp;
|
||||||
} else {
|
} else {
|
||||||
_searchpaths[SP_PERSONAL_DIR].clear();
|
_searchpaths[SP_PERSONAL_DIR].clear();
|
||||||
|
_searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR].clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,8 @@ enum Searchpath : unsigned {
|
||||||
SP_INSTALLATION_DIR, ///< Search in the installation directory
|
SP_INSTALLATION_DIR, ///< Search in the installation directory
|
||||||
SP_APPLICATION_BUNDLE_DIR, ///< Search within the application bundle
|
SP_APPLICATION_BUNDLE_DIR, ///< Search within the application bundle
|
||||||
SP_AUTODOWNLOAD_DIR, ///< Search within the autodownload directory
|
SP_AUTODOWNLOAD_DIR, ///< Search within the autodownload directory
|
||||||
|
SP_AUTODOWNLOAD_PERSONAL_DIR, ///< Search within the autodownload directory located in the personal directory
|
||||||
|
SP_AUTODOWNLOAD_PERSONAL_DIR_XDG, ///< Search within the autodownload directory located in the personal directory (XDG variant)
|
||||||
NUM_SEARCHPATHS
|
NUM_SEARCHPATHS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -466,6 +466,10 @@ void DetermineBasePaths(const char *exe)
|
||||||
tmp += PERSONAL_DIR;
|
tmp += PERSONAL_DIR;
|
||||||
AppendPathSeparator(tmp);
|
AppendPathSeparator(tmp);
|
||||||
_searchpaths[SP_PERSONAL_DIR] = tmp;
|
_searchpaths[SP_PERSONAL_DIR] = tmp;
|
||||||
|
|
||||||
|
tmp += "content_download";
|
||||||
|
AppendPathSeparator(tmp);
|
||||||
|
_searchpaths[SP_AUTODOWNLOAD_PERSONAL_DIR] = tmp;
|
||||||
} else {
|
} else {
|
||||||
_searchpaths[SP_PERSONAL_DIR].clear();
|
_searchpaths[SP_PERSONAL_DIR].clear();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue