From 3da7f71e45eb986aef67771b5af3c1e308971cff Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Tue, 15 Oct 2019 01:47:09 +0200 Subject: Extensions: Fix file test when checking dependencies by type For "executable" files only existence was checked. (Glib::file_test needs a single FileTest) Apply this properly when checking script s and xslt s - interpreted scripts and xslt files -> only check existence - un-interpreted scripts -> check for executable file For Windows workarounds are implemented to yield desirable behavior: - as there is no executable bit, only check existence - as executables usually come with an extensions, scan for those as well. --- src/extension/extension.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/extension/extension.cpp') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index e0f4ed3fe..fedd0facc 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -125,14 +125,16 @@ Extension::Extension(Inkscape::XML::Node *in_repr, Implementation::Implementatio } else if (!strcmp(chname, "script")) { // TODO: should these be parsed in their respective Implementation? for (Inkscape::XML::Node *child = child_repr->firstChild(); child != nullptr; child = child->next()) { if (child->type() == Inkscape::XML::ELEMENT_NODE) { // skip non-element nodes (see LP #1372200) - _deps.push_back(new Dependency(child, this)); + const char *interpreted = child->attribute("interpreter"); + Dependency::type_t type = interpreted ? Dependency::TYPE_FILE : Dependency::TYPE_EXECUTABLE; + _deps.push_back(new Dependency(child, this, type)); break; } } } else if (!strcmp(chname, "xslt")) { // TODO: should these be parsed in their respective Implementation? for (Inkscape::XML::Node *child = child_repr->firstChild(); child != nullptr; child = child->next()) { if (child->type() == Inkscape::XML::ELEMENT_NODE) { // skip non-element nodes (see LP #1372200) - _deps.push_back(new Dependency(child, this)); + _deps.push_back(new Dependency(child, this, Dependency::TYPE_FILE)); break; } } -- cgit v1.2.3