From f02ea25ea62985e1903b84f3e6c47ae9db5f9973 Mon Sep 17 00:00:00 2001 From: chinhodado Date: Sat, 15 Feb 2014 14:01:47 -0500 Subject: [PATCH] fix the "No disk" dialog when starting up ppsspp --- Common/FileUtil.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Common/FileUtil.cpp b/Common/FileUtil.cpp index 2ae97a644a..2cbb3a8bff 100644 --- a/Common/FileUtil.cpp +++ b/Common/FileUtil.cpp @@ -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); }