summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2017-07-01 22:10:31 +0000
committerMartin Owens <doctormo@gmail.com>2017-07-01 22:10:31 +0000
commitf54d8ce2659ae44c10fcdfab5afc9492d39f6dfa (patch)
treed1094b485722bdebd138487a5307448b5c324223
parentUpdate .gitlab-ci.yml (diff)
downloadinkscape-f54d8ce2659ae44c10fcdfab5afc9492d39f6dfa.tar.gz
inkscape-f54d8ce2659ae44c10fcdfab5afc9492d39f6dfa.zip
Hackfest: Tidy and test for file exists in output.
-rw-r--r--src/io/resource.cpp9
1 files changed, 6 insertions, 3 deletions
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 <glibmm/miscutils.h>
#include <glibmm/stringutils.h>
#include <glibmm/fileutils.h>
+
#include "path-prefix.h"
#include "io/sys.h"
#include "io/resource.h"
@@ -218,13 +219,15 @@ void get_filenames_from_path(std::vector<Glib::ustring> &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();
}