From 6efed0740b135a38bec0f21c08abfcaad8b91086 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 4 Mar 2021 16:42:02 -0800 Subject: [PATCH] Ignore directories when loading level metadata Otherwise, this would produce a superfluous warning message in the console. Directories are now ignored and never attempted to be opened; so now any warning messages printed out are genuine file that something has genuinely gone wrong with. Well, there's still a warning message printed if there's a symlink to a directory; this is rarer, but it's still a false positive. --- desktop_version/src/editor.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 7ee8e81f..98a84f53 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -79,6 +79,11 @@ static bool compare_nocase (std::string first, std::string second) static void levelZipCallback(const char* filename) { + if (!FILESYSTEM_isFile(filename)) + { + return; + } + if (endsWith(filename, ".zip")) { FILESYSTEM_loadZip(filename); @@ -201,6 +206,11 @@ static void levelMetaDataCallback(const char* filename) LevelMetaData temp; std::string filename_ = filename; + if (!FILESYSTEM_isFile(filename)) + { + return; + } + if (ed.getLevelMetaData(filename_, temp)) { ed.ListOfMetaData.push_back(temp);