From 3d960d23eaeb6818dee3e50bbf2d1aaaa6a57798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 28 Nov 2024 11:40:52 +0100 Subject: [PATCH] Avoid a couple of unnecessary Exists checks --- Core/Config.cpp | 5 ++++- Windows/main.cpp | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index aa62b14d08..a0d7e7107b 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -53,6 +53,7 @@ #include "Core/ConfigValues.h" #include "Core/Loaders.h" #include "Core/KeyMap.h" +#include "Core/System.h" #include "Core/HLE/sceUtility.h" #include "Core/Instance.h" #include "GPU/Common/FramebufferManagerCommon.h" @@ -1679,7 +1680,9 @@ const Path Config::FindConfigFile(const std::string &baseFilename) { Path parent = filename.NavigateUp(); // We try to create the path and ignore if it fails (already exists). - File::CreateFullPath(parent); + if (parent != GetSysDirectory(DIRECTORY_SYSTEM)) { + File::CreateFullPath(parent); + } return filename; } diff --git a/Windows/main.cpp b/Windows/main.cpp index 50b20cd3a2..2092900862 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -838,10 +838,8 @@ static void InitMemstickDirectory() { // We're screwed anyway if we can't write to Documents, or can't detect it. if (!File::CreateEmptyFile(testFile)) g_Config.memStickDirectory = myDocsPath; - // Clean up our mess. - if (File::Exists(testFile)) - File::Delete(testFile); + File::Delete(testFile); } static void WinMainInit() {