equal
deleted
inserted
replaced
125 fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf); |
125 fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf); |
126 #endif |
126 #endif |
127 } |
127 } |
128 |
128 |
129 #ifdef WITH_COCOA |
129 #ifdef WITH_COCOA |
130 void cocoaSetWorkingDirectory(void); |
130 extern "C" void cocoaSetWorkingDirectory(void); |
131 void cocoaSetupAutoreleasePool(void); |
131 extern "C" void cocoaSetupAutoreleasePool(void); |
132 void cocoaReleaseAutoreleasePool(void); |
132 extern "C" void cocoaReleaseAutoreleasePool(void); |
133 #endif |
133 #endif |
134 |
134 |
135 int CDECL main(int argc, char* argv[]) |
135 int CDECL main(int argc, char* argv[]) |
136 { |
136 { |
137 int ret; |
137 int ret; |
167 |
167 |
168 void DeterminePaths(void) |
168 void DeterminePaths(void) |
169 { |
169 { |
170 char *s; |
170 char *s; |
171 |
171 |
172 _paths.game_data_dir = malloc(MAX_PATH); |
172 MallocT(&_paths.game_data_dir, MAX_PATH); |
173 ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH); |
173 ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH); |
174 #if defined SECOND_DATA_DIR |
174 #if defined SECOND_DATA_DIR |
175 _paths.second_data_dir = malloc(MAX_PATH); |
175 MallocT(&_paths.second_data_dir, MAX_PATH); |
176 ttd_strlcpy(_paths.second_data_dir, SECOND_DATA_DIR, MAX_PATH); |
176 ttd_strlcpy(_paths.second_data_dir, SECOND_DATA_DIR, MAX_PATH); |
177 #endif |
177 #endif |
178 |
178 |
179 #if defined(USE_HOMEDIR) |
179 #if defined(USE_HOMEDIR) |
180 { |
180 { |
188 _paths.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR); |
188 _paths.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR); |
189 } |
189 } |
190 |
190 |
191 #else /* not defined(USE_HOMEDIR) */ |
191 #else /* not defined(USE_HOMEDIR) */ |
192 |
192 |
193 _paths.personal_dir = malloc(MAX_PATH); |
193 MallocT(&_paths.personal_dir, MAX_PATH); |
194 ttd_strlcpy(_paths.personal_dir, PERSONAL_DIR, MAX_PATH); |
194 ttd_strlcpy(_paths.personal_dir, PERSONAL_DIR, MAX_PATH); |
195 |
195 |
196 // check if absolute or relative path |
196 // check if absolute or relative path |
197 s = strchr(_paths.personal_dir, '/'); |
197 s = strchr(_paths.personal_dir, '/'); |
198 |
198 |
224 _highscore_file = str_fmt("%shs.dat", _paths.personal_dir); |
224 _highscore_file = str_fmt("%shs.dat", _paths.personal_dir); |
225 _log_file = str_fmt("%sopenttd.log", _paths.personal_dir); |
225 _log_file = str_fmt("%sopenttd.log", _paths.personal_dir); |
226 |
226 |
227 #if defined CUSTOM_LANG_DIR |
227 #if defined CUSTOM_LANG_DIR |
228 // sets the search path for lng files to the custom one |
228 // sets the search path for lng files to the custom one |
229 _paths.lang_dir = malloc( MAX_PATH ); |
229 MallocT(&_paths.lang_dir, MAX_PATH ); |
230 ttd_strlcpy( _paths.lang_dir, CUSTOM_LANG_DIR, MAX_PATH); |
230 ttd_strlcpy( _paths.lang_dir, CUSTOM_LANG_DIR, MAX_PATH); |
231 #else |
231 #else |
232 _paths.lang_dir = str_fmt("%slang/", _paths.game_data_dir); |
232 _paths.lang_dir = str_fmt("%slang/", _paths.game_data_dir); |
233 #endif |
233 #endif |
234 |
234 |