fix the "No disk" dialog when starting up ppsspp

This commit is contained in:
chinhodado 2014-02-15 14:01:47 -05:00
parent 0ebce17e7f
commit f02ea25ea6

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);
}