diff --git a/src/unix.cpp b/src/unix.cpp --- a/src/unix.cpp +++ b/src/unix.cpp @@ -7,7 +7,6 @@ #include "string.h" #include "table/strings.h" #include "variables.h" -#include "fileio.h" #include #include @@ -101,18 +100,6 @@ bool FiosIsHiddenFile(const struct diren return ent->d_name[0] == '.'; } -#if defined(__BEOS__) || defined(__linux__) -static void ChangeWorkingDirectory(char *exe) -{ - char *s = strrchr(exe, '/'); - if (s != NULL) { - *s = '\0'; - chdir(exe); - *s = '/'; - } -} -#endif - void ShowInfo(const char *str) { fprintf(stderr, "%s\n", str); @@ -131,7 +118,6 @@ void ShowOSErrorBox(const char *buf) } #ifdef WITH_COCOA -void cocoaSetWorkingDirectory(); void cocoaSetupAutoreleasePool(); void cocoaReleaseAutoreleasePool(); #endif @@ -146,15 +132,9 @@ int CDECL main(int argc, char* argv[]) if (argc >= 2 && strncmp(argv[1], "-psn", 4) == 0) { argv[1] = NULL; argc = 1; - cocoaSetWorkingDirectory(); } #endif - // change the working directory to enable doubleclicking in UIs -#if defined(__BEOS__) || defined(__linux__) - ChangeWorkingDirectory(argv[0]); -#endif - _random_seeds[1][1] = _random_seeds[1][0] = _random_seeds[0][1] = _random_seeds[0][0] = time(NULL); SeedMT(_random_seeds[0][1]); @@ -169,43 +149,6 @@ int CDECL main(int argc, char* argv[]) return ret; } -void DetermineBasePaths() -{ - _paths.game_data_dir = MallocT(MAX_PATH); - ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH); -#if defined(SECOND_DATA_DIR) - _paths.second_data_dir = MallocT(MAX_PATH); - ttd_strlcpy(_paths.second_data_dir, SECOND_DATA_DIR, MAX_PATH); -#endif - -#if defined(USE_HOMEDIR) - const char *homedir = getenv("HOME"); - - if (homedir == NULL) { - const struct passwd *pw = getpwuid(getuid()); - if (pw != NULL) homedir = pw->pw_dir; - } - - _paths.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR); -#else /* not defined(USE_HOMEDIR) */ - _paths.personal_dir = MallocT(MAX_PATH); - ttd_strlcpy(_paths.personal_dir, PERSONAL_DIR, MAX_PATH); - - /* check if absolute or relative path */ - const char *s = strchr(_paths.personal_dir, PATHSEPCHAR); - - /* add absolute path */ - if (s == NULL || _paths.personal_dir != s) { - getcwd(_paths.personal_dir, MAX_PATH); - AppendPathSeparator(_paths.personal_dir, MAX_PATH); - ttd_strlcat(_paths.personal_dir, PERSONAL_DIR, MAX_PATH); - } -#endif /* defined(USE_HOMEDIR) */ - - AppendPathSeparator(_paths.personal_dir, MAX_PATH); - AppendPathSeparator(_paths.game_data_dir, MAX_PATH); -} - bool InsertTextBufferClipboard(Textbuf *tb) { return false;