1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 13:33:02 +01:00

Let user specify the data dir as cmdline option.

This adds --openrct-data-dir=<str> option to command line letting user
select where he wants OpenRCT2-specific data to be. By default the
search locations are:
* <exePath>/data (on all platforms)
* /var/lib/openrct2 (on Linux)
* /usr/share/openrct2 (on Linux)
This commit is contained in:
Michał Janiszewski
2015-12-17 22:49:39 +01:00
parent 859c35574a
commit ea6fa2c82a
10 changed files with 125 additions and 10 deletions

View File

@@ -146,19 +146,21 @@ const char *language_get_string(rct_string_id id)
int language_open(int id)
{
static const char *languagePath = "%s/data/language/%s.txt";
static const char *languagePath = "%s/language/%s.txt";
char filename[MAX_PATH];
char dataPath[MAX_PATH];
language_close_all();
if (id == LANGUAGE_UNDEFINED)
return 1;
platform_get_openrct_data_path(dataPath);
if (id != LANGUAGE_ENGLISH_UK) {
sprintf(filename, languagePath, gExePath, LanguagesDescriptors[LANGUAGE_ENGLISH_UK].path);
sprintf(filename, languagePath, dataPath, LanguagesDescriptors[LANGUAGE_ENGLISH_UK].path);
_languageFallback = LanguagePack::FromFile(LANGUAGE_ENGLISH_UK, filename);
}
sprintf(filename, languagePath, gExePath, LanguagesDescriptors[id].path);
sprintf(filename, languagePath, dataPath, LanguagesDescriptors[id].path);
_languageCurrent = LanguagePack::FromFile(id, filename);
if (_languageCurrent != nullptr) {
gCurrentLanguage = id;