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); 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);