unix.c
changeset 561 e3b9689745ab
parent 543 e3b43338096b
child 569 2e86ae517874
--- a/unix.c	Mon Dec 06 00:03:26 2004 +0000
+++ b/unix.c	Tue Dec 07 17:16:57 2004 +0000
@@ -424,7 +424,7 @@
 	// 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 @@
 	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 @@
 #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 @@
 		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 @@
 	_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);
+	_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);
-
-	_config_file = str_fmt("%sopenttd.cfg", _path.personal_dir);
+#endif
 
 	// create necessary folders
 	mkdir(_path.personal_dir, 0755);