]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Utils/Folders.cpp
Trying to handle a bit better missing files and avoid segfaults
[lugaru.git] / Source / Utils / Folders.cpp
index 9a6f8137a536ba574dca9db8b075baebc693cd39..c4e86abf17ab2344d92fdda55edd3e9b130c3428 100644 (file)
@@ -135,3 +135,12 @@ bool Folders::makeDirectory(std::string path) {
     }
 #endif
 }
+
+FILE* Folders::openMandatoryFile(std::string filename, const char* mode)
+{
+    FILE* tfile = fopen(filename.c_str(), mode);
+    if (tfile == NULL) {
+        throw FileNotFoundException(filename);
+    }
+    return tfile;
+}