Merge pull request #5465 from chinhodado/master

fix the "No disk" dialog when starting up ppsspp
This commit is contained in:
Henrik Rydgård 2014-02-15 20:03:49 +01:00
commit c81a08eed7

View File

@ -133,6 +133,10 @@ static void StripTailDirSlashes(std::wstring &fname)
// Returns true if file filename exists
bool Exists(const std::string &filename)
{
// Make sure Windows will no longer handle critical errors, which means no annoying "No disk" dialog
// Save the old error mode
int OldMode = SetErrorMode(SEM_FAILCRITICALERRORS);
struct stat64 file_info;
#if defined(_WIN32) && defined(UNICODE)
std::wstring copy = ConvertUTF8ToWString(filename);
@ -145,6 +149,10 @@ bool Exists(const std::string &filename)
int result = stat64(copy.c_str(), &file_info);
#endif
// Set the old error mode
SetErrorMode(OldMode);
return (result == 0);
}