diff options
author | rubidium <rubidium@openttd.org> | 2007-03-17 11:36:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-03-17 11:36:04 +0000 |
commit | 50b2088674b5835aaab3985d7dcc7473c1a3b08c (patch) | |
tree | 287f1391a600cfd916be1d6a412e6f232945aba4 /src/os2.cpp | |
parent | 92486ac980175b06fc22f2456d78737ead6eabfa (diff) | |
download | openttd-50b2088674b5835aaab3985d7dcc7473c1a3b08c.tar.xz |
(svn r9266) -Codechange: unify the retrieval of the base paths a little more.
Diffstat (limited to 'src/os2.cpp')
-rw-r--r-- | src/os2.cpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/os2.cpp b/src/os2.cpp index 627c26f57..25b82a36c 100644 --- a/src/os2.cpp +++ b/src/os2.cpp @@ -122,18 +122,6 @@ bool FiosIsHiddenFile(const struct dirent *ent) return ent->d_name[0] == '.'; } - -static void ChangeWorkingDirectory(char *exe) -{ - char *s = strrchr(exe, PATHSEPCHAR); - - if (s != NULL) { - *s = '\0'; - chdir(exe); - *s = PATHSEPCHAR; - } -} - void ShowInfo(const unsigned char *str) { HAB hab; @@ -178,43 +166,6 @@ int CDECL main(int argc, char* argv[]) return ttd_main(argc, argv); } -void DetermineBasePaths() -{ - _paths.game_data_dir = MallocT<char>(MAX_PATH); - ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH); -#if defined(SECOND_DATA_DIR) - _paths.second_data_dir = MallocT<char>(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<char>(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); -} - /** * Insert a chunk of text from the clipboard onto the textbuffer. Get TEXT clipboard * and append this up to the maximum length (either absolute or screenlength). If maxlength |