From 155c9d235f8e1fc3992c82851cabab4c71af4acd Mon Sep 17 00:00:00 2001 From: bjarni Date: Tue, 7 Dec 2004 17:16:57 +0000 Subject: (svn r970) Added 2nd data path for all non-windows OSes added completely customizable lang path (all non-Windows OSes) --- unix.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'unix.c') diff --git a/unix.c b/unix.c index fe0ecb101..c8b300a4c 100644 --- a/unix.c +++ b/unix.c @@ -424,7 +424,7 @@ void ShowOSErrorBox(const char *buf) // this creates an error in the console and then opens the console. // Colourcodes are not used in the console, so they are skipped here fprintf(stderr, "Error: %s", buf); - system("/Applications/Utilities/Console.app/Contents/MacOS/Console"); + system("/Applications/Utilities/Console.app/Contents/MacOS/Console &"); #else // all systems, but OSX fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf); @@ -452,7 +452,11 @@ void DeterminePaths() char *s; _path.game_data_dir = malloc( MAX_PATH ); - strcpy(_path.game_data_dir, GAME_DATA_DIR); + ttd_strlcpy(_path.game_data_dir, GAME_DATA_DIR, MAX_PATH); + #if defined SECOND_DATA_DIR + _path.second_data_dir = malloc( MAX_PATH ); + ttd_strlcpy( _path.second_data_dir, SECOND_DATA_DIR, MAX_PATH); + #endif #if defined(USE_HOMEDIR) { @@ -470,7 +474,7 @@ void DeterminePaths() #else /* not defined(USE_HOMEDIR) */ _path.personal_dir = malloc( MAX_PATH ); - strcpy(_path.personal_dir, PERSONAL_DIR); + ttd_strlcpy(_path.personal_dir, PERSONAL_DIR, MAX_PATH); // check if absolute or relative path s = strchr(_path.personal_dir, '/'); @@ -480,7 +484,7 @@ void DeterminePaths() getcwd(_path.personal_dir, MAX_PATH); s = strchr(_path.personal_dir, 0); *s++ = '/'; - strcpy(s, PERSONAL_DIR); + ttd_strlcpy(s, PERSONAL_DIR, MAX_PATH); } #endif /* defined(USE_HOMEDIR) */ @@ -495,9 +499,15 @@ void DeterminePaths() _path.scenario_dir = str_fmt("%sscenario", _path.personal_dir); _path.gm_dir = str_fmt("%sgm/", _path.game_data_dir); _path.data_dir = str_fmt("%sdata/", _path.game_data_dir); - _path.lang_dir = str_fmt("%slang/", _path.game_data_dir); - _config_file = str_fmt("%sopenttd.cfg", _path.personal_dir); + +#if defined CUSTOM_LANG_DIR + // sets the search path for lng files to the custom one + _path.lang_dir = malloc( MAX_PATH ); + ttd_strlcpy( _path.lang_dir, CUSTOM_LANG_DIR, MAX_PATH); +#else + _path.lang_dir = str_fmt("%slang/", _path.game_data_dir); +#endif // create necessary folders mkdir(_path.personal_dir, 0755); -- cgit v1.2.3-54-g00ecf