From 4a94aff826f45b61b4fc27ea65c7df0650a85118 Mon Sep 17 00:00:00 2001 From: MyNameIsTrez Date: Mon, 15 Jan 2024 19:21:20 +0100 Subject: [PATCH 1/2] Early return out of GetCaseInsensitiveFullPath --- Source/System/RTETools.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/System/RTETools.cpp b/Source/System/RTETools.cpp index 81f36c635c..ac944a3112 100644 --- a/Source/System/RTETools.cpp +++ b/Source/System/RTETools.cpp @@ -222,6 +222,10 @@ namespace RTE { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// std::string GetCaseInsensitiveFullPath(const std::string &fullPath) { + if (std::filesystem::exists(fullPath)) { + return fullPath; + } + std::filesystem::path inspectedPath = System::GetWorkingDirectory(); const std::filesystem::path relativeFilePath = std::filesystem::path(fullPath).lexically_relative(inspectedPath); From e031fb978c3c889d09b13a32ab0a74fac5c2d5cd Mon Sep 17 00:00:00 2001 From: MyNameIsTrez Date: Mon, 15 Jan 2024 19:41:16 +0100 Subject: [PATCH 2/2] Early return in FileOpen --- Source/Managers/LuaMan.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Managers/LuaMan.cpp b/Source/Managers/LuaMan.cpp index 1395d48169..33e68b48a7 100644 --- a/Source/Managers/LuaMan.cpp +++ b/Source/Managers/LuaMan.cpp @@ -1043,6 +1043,10 @@ namespace RTE { FILE *file = fopen(fullPath.c_str(), accessMode.c_str()); #else FILE *file = [&fullPath, &accessMode]() -> FILE* { + if (std::filesystem::exists(fullPath)) { + return fopen(fullPath.c_str(), accessMode.c_str()); + } + std::filesystem::path inspectedPath = System::GetWorkingDirectory(); const std::filesystem::path relativeFilePath = std::filesystem::path(fullPath).lexically_relative(inspectedPath);