Better error messages, Dolphin will create save directories if not present.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@37 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-07-20 21:20:22 +00:00
parent 4175db3aa3
commit 36f8b9751a
9 changed files with 82 additions and 22 deletions

View File

@ -51,3 +51,25 @@ void File::Explore(const std::string &path)
ShellExecuteEx(&shex);
#endif
}
// Returns true if successful, or path already exists.
bool File::CreateDir(const std::string &path)
{
#ifdef _WIN32
if (::CreateDirectory(path.c_str(), NULL))
{
return true;
}
else
{
DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS)
{
PanicAlert("%s already exists", path.c_str());
return true;
}
PanicAlert("Error creating directory: %i", error);
return false;
}
#endif
}