diff options
author | rubidium <rubidium@openttd.org> | 2007-06-08 21:16:17 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-06-08 21:16:17 +0000 |
commit | 142f2aba15a3b37ff3aa9955c560deba6cd1572d (patch) | |
tree | 2aa048761612cb8d8155c246652c144c826b0fec /src/win32.cpp | |
parent | 653b34301823f8e83a844c4eb2a26c6c26f374d0 (diff) | |
download | openttd-142f2aba15a3b37ff3aa9955c560deba6cd1572d.tar.xz |
(svn r10073) -Codechange: make the NewGRF paths in the config file without any full paths (again).
Diffstat (limited to 'src/win32.cpp')
-rw-r--r-- | src/win32.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/win32.cpp b/src/win32.cpp index 4d99536d1..fc119ce8e 100644 --- a/src/win32.cpp +++ b/src/win32.cpp @@ -946,16 +946,30 @@ void GetCurrentDirectoryW(int length, wchar_t *path) } #endif -void DetermineBasePaths(const char *exe) +char *getcwd(char *buf, size_t size) { - _paths.personal_dir = _paths.game_data_dir = MallocT<char>(MAX_PATH); - _paths.second_data_dir = NULL; #if defined(UNICODE) TCHAR path[MAX_PATH]; GetCurrentDirectory(MAX_PATH - 1, path); - convert_from_fs(path, _paths.personal_dir, MAX_PATH); + convert_from_fs(path, buf, size); #else - GetCurrentDirectory(MAX_PATH - 1, _paths.personal_dir); + GetCurrentDirectory(size, buf); +#endif + return buf; +} + +extern char *BuildWithFullPath(const char *dir); + +void DetermineBasePaths(const char *exe) +{ + _paths.personal_dir = MallocT<char>(MAX_PATH); + getcwd(_paths.personal_dir, MAX_PATH); + + _paths.game_data_dir = BuildWithFullPath(GAME_DATA_DIR); +#if defined(SECOND_DATA_DIR) + _paths.second_data_dir = BuildWithFullPath(SECOND_DATA_DIR); +#else + _paths.second_data_dir = NULL; #endif _paths.personal_dir[0] = toupper(_paths.personal_dir[0]); |