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

@ -200,54 +200,9 @@ bool DolphinApp::OnInit()
}
#ifdef _WIN32
// Keep the user config dir free unless user wants to save the working dir
if (!File::Exists(File::GetUserPath(D_CONFIG_IDX) + "portable"))
if (!wxSetWorkingDirectory(wxString(File::GetExeDirectory().c_str(), *wxConvCurrent)))
{
char tmp[1024];
sprintf(tmp, "%s/.dolphin%swd", (const char*)wxStandardPaths::Get().GetUserConfigDir().mb_str(),
#ifdef _M_IX86
"x32");
#else
"x64");
#endif
std::ifstream workingDir(tmp);
if (!workingDir)
{
if (PanicYesNoT("Dolphin has not been configured with an install location,\nKeep Dolphin portable?"))
{
std::ofstream portable((File::GetUserPath(D_CONFIG_IDX) + "portable").c_str());
if (!portable)
{
PanicAlertT("Portable Setting could not be saved\n Are you running Dolphin from read only media or from a directory that dolphin is not located in?");
}
}
else
{
char CWD[1024];
sprintf(CWD, "%s", (const char*)wxGetCwd().mb_str());
if (PanicYesNoT("Set install location to:\n %s ?", CWD))
{
std::ofstream workingDirF(tmp);
if (!workingDirF)
PanicAlertT("Install directory could not be saved");
else
{
workingDirF << CWD << '\n';
}
}
else
PanicAlertT("Relaunch Dolphin from the install directory and save from there");
}
}
else
{
std::string tmpChar;
std::getline(workingDir, tmpChar);
if (!wxSetWorkingDirectory(wxString::From8BitData(tmpChar.c_str())))
{
INFO_LOG(CONSOLE, "set working directory failed");
}
}
INFO_LOG(CONSOLE, "set working directory failed");
}
#else
//create all necessary directories in user directory