Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

Common: Return from CreateFullPath early if the directory creation fails

archshifta7c7946867c0
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 78a6425997..9e40e87d48 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -190,8 +190,10 @@ bool CreateFullPath(const std::string &fullPath)
// Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
std::string const subPath(fullPath.substr(0, position + 1));
- if (!FileUtil::IsDirectory(subPath))
- FileUtil::CreateDir(subPath);
+ if (!FileUtil::IsDirectory(subPath) && !FileUtil::CreateDir(subPath)) {
+ ERROR_LOG(COMMON, "CreateFullPath: directory creation failed");
+ return false;
+ }
// A safety check
panicCounter--;