From dd138fc460dcbab37452e90ff070a31516994aa2 Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Sun, 6 Dec 2020 21:11:42 +0100 Subject: Codechange: Stringify config file paths. --- src/os/windows/crashlog_win.cpp | 2 +- src/os/windows/win32.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/os/windows') diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index 7a1a524aa..c96c4cf7c 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -499,7 +499,7 @@ char *CrashLogWindows::AppendDecodedStacktrace(char *buffer, const char *last) c CONST PMINIDUMP_CALLBACK_INFORMATION); MiniDumpWriteDump_t funcMiniDumpWriteDump = (MiniDumpWriteDump_t)GetProcAddress(dbghelp, "MiniDumpWriteDump"); if (funcMiniDumpWriteDump != nullptr) { - seprintf(filename, filename_last, "%scrash.dmp", _personal_dir); + seprintf(filename, filename_last, "%scrash.dmp", _personal_dir.c_str()); HANDLE file = CreateFile(OTTD2FS(filename), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, 0); HANDLE proc = GetCurrentProcess(); DWORD procid = GetCurrentProcessId(); diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 468234391..c4e400279 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -451,7 +451,7 @@ char *getcwd(char *buf, size_t size) return buf; } -extern char *_config_file; +extern std::string _config_file; void DetermineBasePaths(const char *exe) { @@ -482,7 +482,7 @@ void DetermineBasePaths(const char *exe) _searchpaths[SP_SHARED_DIR] = nullptr; #endif - if (_config_file == nullptr) { + if (_config_file.empty()) { /* Get the path to working directory of OpenTTD. */ getcwd(tmp, lengthof(tmp)); AppendPathSeparator(tmp, lastof(tmp)); @@ -490,7 +490,7 @@ void DetermineBasePaths(const char *exe) } else { /* Use the folder of the config file as working directory. */ TCHAR config_dir[MAX_PATH]; - _tcsncpy(path, convert_to_fs(_config_file, path, lengthof(path)), lengthof(path)); + _tcsncpy(path, convert_to_fs(_config_file.c_str(), path, lengthof(path)), lengthof(path)); if (!GetFullPathName(path, lengthof(config_dir), config_dir, nullptr)) { DEBUG(misc, 0, "GetFullPathName failed (%lu)\n", GetLastError()); _searchpaths[SP_WORKING_DIR] = nullptr; -- cgit v1.2.3-54-g00ecf