From 1d29204ae651c1d41b752914457904348319087c Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sat, 11 Jun 2011 20:45:09 +0000 Subject: Windows: Sets the cwd to the folder that dolphin.exe resides in. Removes the ugliness that was the portable file, and now creating a shortcut or file association is less of a pain it is still necessary to modify the file association from ".../dolphin.exe" "%1" to ".../dolphin.exe" /e "%1" git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7593 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/FileUtil.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Source/Core/Common/Src/FileUtil.cpp') diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index d68ee74eaf..6dd800b723 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -601,6 +601,21 @@ std::string GetBundleDirectory() } #endif +#ifdef _WIN32 +std::string &GetExeDirectory() +{ + static std::string DolphinPath; + if (DolphinPath.empty()) + { + char Dolphin_exe_Path[2048]; + GetModuleFileNameA(NULL, Dolphin_exe_Path, 2048); + DolphinPath = Dolphin_exe_Path; + DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\')); + } + return DolphinPath; +} +#endif + std::string GetSysDirectory() { std::string sysDir; @@ -628,6 +643,7 @@ std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath) if (paths[D_USER_IDX].empty()) { #ifdef _WIN32 + // TODO: use GetExeDirectory() here instead of ROOT_DIR so that if the cwd is changed we still have the correct paths? paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP; #else if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR)) -- cgit v1.2.3