diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2013-02-15 13:12:46 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2013-02-15 13:12:46 +0000 |
| commit | 3441298ed44e1a00f2c71b73a582755d7bda7cd5 (patch) | |
| tree | 1df1c9507fd02a480d75b293ab1430bce589907a /src | |
| parent | fix yet another warning (diff) | |
| download | inkscape-3441298ed44e1a00f2c71b73a582755d7bda7cd5.tar.gz inkscape-3441298ed44e1a00f2c71b73a582755d7bda7cd5.zip | |
Better fix for Bug #911146 (Inkscape reads .eps files from /tmp instead of the current directory) by Michael Karcher.
(bzr r12127)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/implementation/script.cpp | 9 | ||||
| -rw-r--r-- | src/extension/system.cpp | 34 |
2 files changed, 8 insertions, 35 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index d3aeace55..4af778e04 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -956,7 +956,14 @@ int Script::execute (const std::list<std::string> &in_command, // assemble the rest of argv std::copy(in_params.begin(), in_params.end(), std::back_inserter(argv)); if (!filein.empty()) { - argv.push_back(filein); + if(Glib::path_is_absolute(filein)) + argv.push_back(filein); + else { + std::vector<std::string> buildargs; + buildargs.push_back(Glib::get_current_dir()); + buildargs.push_back(filein); + argv.push_back(Glib::build_filename(buildargs)); + } } int stdout_pipe, stderr_pipe; diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 60cd21d71..a9ca5c456 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -69,34 +69,6 @@ static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementatio */ SPDocument *open(Extension *key, gchar const *filename) { - // Convert to absolute pathname to tolerate chdir(). - bool relpath = (filename[0] != '/'); -#ifdef WIN32 - relpath &= (filename[0] != '\\') && !(isalpha(filename[0]) && (filename[1] == ':')); -#endif - - // Do not consider an URI as a relative path. - if (relpath) { - gchar const * cp = filename; - - while (isalpha(*cp) || isdigit(*cp) || *cp == '+' || *cp == '-' || *cp == '.') - cp++; - - relpath = *cp != ':' || cp[1] != '/' || cp[2] != '/'; - } - - if (relpath) { - gchar * curdir = NULL; -#ifndef WIN32 - curdir = getcwd(NULL, 0); -#else - curdir = _getcwd(NULL, 0); -#endif - - filename = g_build_filename(curdir, filename, NULL); - free(curdir); - } - Input *imod = NULL; if (key == NULL) { @@ -138,9 +110,6 @@ SPDocument *open(Extension *key, gchar const *filename) } if (!imod->prefs(filename)) { - if (relpath){ - free((void *) filename); - } return NULL; } @@ -163,9 +132,6 @@ SPDocument *open(Extension *key, gchar const *filename) imod->set_gui(true); } - if (relpath){ - free((void *) filename); - } return doc; } |
