Skip to content

Commit

Permalink
Merge pull request #5465 from chinhodado/master
Browse files Browse the repository at this point in the history
fix the "No disk" dialog when starting up ppsspp
  • Loading branch information
hrydgard committed Feb 15, 2014
2 parents 0ebce17 + f02ea25 commit c81a08e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Common/FileUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down

0 comments on commit c81a08e

Please sign in to comment.