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

@ -128,6 +128,7 @@ void CPUInfoStruct::Detect()
// Interpret CPU brand string and cache information.
if (i == 0x80000001)
{
// This block seems bugged.
nFeatureInfo2 = CPUInfo[1]; // ECX
bSSE5 = (nFeatureInfo2 & (1 << 11)) ? true : false;
bLZCNT = (nFeatureInfo2 & (1 << 5)) ? true : false;

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
}

View File

@ -10,6 +10,7 @@ public:
static void Launch(const std::string &filename);
static void Explore(const std::string &path);
static bool IsDirectory(const std::string &filename);
static bool CreateDir(const std::string &filename);
};
#endif