summaryrefslogtreecommitdiffstats
path: root/src/extension/implementation/script.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-04-07 23:42:04 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-04-07 23:42:04 +0000
commit945ce419c806c73d70203dec33ececafbe108a92 (patch)
treecfcdb59bf47e9db7f9e01f7eebb59924bdeaea94 /src/extension/implementation/script.cpp
parentMerge from trunk (again) (diff)
parentExtensions. SVG+media fix (see Bug #400356). (diff)
downloadinkscape-945ce419c806c73d70203dec33ececafbe108a92.tar.gz
inkscape-945ce419c806c73d70203dec33ececafbe108a92.zip
Merge from trunk
(bzr r9508.1.73)
Diffstat (limited to 'src/extension/implementation/script.cpp')
-rw-r--r--src/extension/implementation/script.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index bc143fd14..2f3e2cd65 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -45,7 +45,7 @@
#include "xml/attribute-record.h"
#include "util/glib-list-iterators.h"
-
+#include "path-prefix.h"
#ifdef WIN32
@@ -189,7 +189,6 @@ Script::solve_reldir(Inkscape::XML::Node *reprin) {
}
Glib::ustring reldir = s;
-
for (unsigned int i=0;
i < Inkscape::Extension::Extension::search_path.size();
i++) {
@@ -200,7 +199,7 @@ Script::solve_reldir(Inkscape::XML::Node *reprin) {
NULL);
Glib::ustring filename = fname;
g_free(fname);
-
+ //printf("Filename: %s\n", filename.c_str());
if ( Inkscape::IO::file_test(filename.c_str(), G_FILE_TEST_EXISTS) ) {
return Glib::filename_from_utf8(filename);
}
@@ -229,14 +228,13 @@ Script::solve_reldir(Inkscape::XML::Node *reprin) {
*/
bool Script::check_existence(const std::string &command)
{
-
// Check the simple case first
if (command.empty()) {
return false;
}
//Don't search when it is an absolute path. */
- if (!Glib::path_is_absolute(command)) {
+ if (Glib::path_is_absolute(command)) {
if (Glib::file_test(command, Glib::FILE_TEST_EXISTS)) {
return true;
} else {
@@ -244,12 +242,11 @@ bool Script::check_existence(const std::string &command)
}
}
- std::string path = Glib::getenv("PATH");
- if (path.empty()) {
- /* There is no `PATH' in the environment.
- The default search path is the current directory */
- path = G_SEARCHPATH_SEPARATOR_S;
- }
+ // First search in the current directory
+ std::string path = G_SEARCHPATH_SEPARATOR_S;
+ path.append(";");
+ // And then in the PATH environment variable.
+ path.append(Glib::getenv("PATH"));
std::string::size_type pos = 0;
std::string::size_type pos2 = 0;
@@ -379,8 +376,11 @@ Script::check(Inkscape::Extension::Extension *module)
if (!command_text.empty()) {
/* I've got the command */
bool existance = check_existence(command_text);
- if (!existance)
+ if (!existance) {
return false;
+ }
+ } else {
+ return false;
}
}
@@ -603,7 +603,7 @@ void Script::save(Inkscape::Extension::Output *module,
file_listener fileout;
int data_read = execute(command, params, tempfilename_in, fileout);
-
+
bool success = false;
if (data_read > 0) {