|
@@ -468,31 +468,31 @@ void DetermineBasePaths(const char *exe)
|
|
|
_searchpaths[SP_WORKING_DIR] = cwd_s;
|
|
|
} else {
|
|
|
/* Use the folder of the config file as working directory. */
|
|
|
wchar_t config_dir[MAX_PATH];
|
|
|
wcsncpy(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());
|
|
|
Debug(misc, 0, "GetFullPathName failed ({})", GetLastError());
|
|
|
_searchpaths[SP_WORKING_DIR].clear();
|
|
|
} else {
|
|
|
std::string tmp(FS2OTTD(config_dir));
|
|
|
auto pos = tmp.find_last_of(PATHSEPCHAR);
|
|
|
if (pos != std::string::npos) tmp.erase(pos + 1);
|
|
|
|
|
|
_searchpaths[SP_WORKING_DIR] = tmp;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!GetModuleFileName(nullptr, path, lengthof(path))) {
|
|
|
DEBUG(misc, 0, "GetModuleFileName failed (%lu)\n", GetLastError());
|
|
|
Debug(misc, 0, "GetModuleFileName failed ({})", GetLastError());
|
|
|
_searchpaths[SP_BINARY_DIR].clear();
|
|
|
} else {
|
|
|
wchar_t exec_dir[MAX_PATH];
|
|
|
wcsncpy(path, convert_to_fs(exe, path, lengthof(path)), lengthof(path));
|
|
|
if (!GetFullPathName(path, lengthof(exec_dir), exec_dir, nullptr)) {
|
|
|
DEBUG(misc, 0, "GetFullPathName failed (%lu)\n", GetLastError());
|
|
|
Debug(misc, 0, "GetFullPathName failed ({})", GetLastError());
|
|
|
_searchpaths[SP_BINARY_DIR].clear();
|
|
|
} else {
|
|
|
std::string tmp(FS2OTTD(exec_dir));
|
|
|
auto pos = tmp.find_last_of(PATHSEPCHAR);
|
|
|
if (pos != std::string::npos) tmp.erase(pos + 1);
|
|
|
|