From f54d8ce2659ae44c10fcdfab5afc9492d39f6dfa Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Sun, 2 Jul 2017 00:10:31 +0200 Subject: Hackfest: Tidy and test for file exists in output. --- src/io/resource.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/io/resource.cpp') diff --git a/src/io/resource.cpp b/src/io/resource.cpp index dbce8a3f4..6a388c1ac 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -23,6 +23,7 @@ #include #include #include + #include "path-prefix.h" #include "io/sys.h" #include "io/resource.h" @@ -218,13 +219,15 @@ void get_filenames_from_path(std::vector &files, Glib::ustring pa while (!file.empty()){ bool reject = false; for (auto &ext: extensions) { - reject = reject || !Glib::str_has_suffix(file, ext); + reject |= !Glib::str_has_suffix(file, ext); } for (auto &exc: exclusions) { - reject = reject || (file == exc); + reject |= Glib::str_has_prefix(file, exc); } + Glib::ustring filename = Glib::build_filename(path, file); + reject |= !Glib::file_test(filename, Glib::FILE_TEST_IS_REGULAR); if(!reject) { - files.push_back(Glib::build_filename(path, file)); + files.push_back(filename); } file = dir.read_name(); } -- cgit v1.2.3