]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Utils/Folders.cpp
Console: Return gracefully when loading missing level
[lugaru.git] / Source / Utils / Folders.cpp
index 8f2bc18feddfc1c2b44af47ac1adbc5592240448..3fa04025823b3502f4959ebc50e8a5fb83d6b57f 100644 (file)
@@ -133,3 +133,15 @@ FILE* Folders::openMandatoryFile(const std::string& filename, const char* mode)
     }
     return tfile;
 }
+
+bool Folders::file_exists(const std::string& filepath)
+{
+    FILE* file;
+    file = fopen(filepath.c_str(), "rb");
+    if (file == NULL) {
+        return false;
+    } else {
+        fclose(file);
+        return true;
+    }
+}