GetExeDirectory() shouldn't return paths with /../ in the middle.

This commit is contained in:
Admiral H. Curtiss 2015-06-26 23:43:45 +02:00
parent 6818f2e092
commit df70f50fdf

View File

@ -731,8 +731,12 @@ std::string& GetExeDirectory()
if (DolphinPath.empty())
{
TCHAR Dolphin_exe_Path[2048];
TCHAR Dolphin_exe_Clean_Path[MAX_PATH];
GetModuleFileName(nullptr, Dolphin_exe_Path, 2048);
DolphinPath = TStrToUTF8(Dolphin_exe_Path);
if (_tfullpath(Dolphin_exe_Clean_Path, Dolphin_exe_Path, MAX_PATH) != nullptr)
DolphinPath = TStrToUTF8(Dolphin_exe_Clean_Path);
else
DolphinPath = TStrToUTF8(Dolphin_exe_Path);
DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\'));
}
return DolphinPath;