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
This commit is contained in:
LPFaint99
2011-06-11 20:45:09 +00:00
parent 8244efcc02
commit 1d29204ae6
4 changed files with 22 additions and 47 deletions

View File

@ -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))