Skip to content

Commit e031fb9

Browse files
committed
Early return in FileOpen
1 parent 4a94aff commit e031fb9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Source/Managers/LuaMan.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,10 @@ namespace RTE {
10431043
FILE *file = fopen(fullPath.c_str(), accessMode.c_str());
10441044
#else
10451045
FILE *file = [&fullPath, &accessMode]() -> FILE* {
1046+
if (std::filesystem::exists(fullPath)) {
1047+
return fopen(fullPath.c_str(), accessMode.c_str());
1048+
}
1049+
10461050
std::filesystem::path inspectedPath = System::GetWorkingDirectory();
10471051
const std::filesystem::path relativeFilePath = std::filesystem::path(fullPath).lexically_relative(inspectedPath);
10481052

0 commit comments

Comments
 (0)