diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2012-03-07 20:23:15 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2012-03-07 20:23:15 +0000 |
| commit | 7bb12c64a4e4564ab505930309b5a9e80833a888 (patch) | |
| tree | ff3338195944206c638fe9427446166c807ed24c /src/ui/context-menu.cpp | |
| parent | cppcheck (diff) | |
| download | inkscape-7bb12c64a4e4564ab505930309b5a9e80833a888.tar.gz inkscape-7bb12c64a4e4564ab505930309b5a9e80833a888.zip | |
Bitmaps. Fix for bug #499252 (Edit bitmap externally fails for relative links).
Fixed bugs:
- https://launchpad.net/bugs/499252
(bzr r11053)
Diffstat (limited to 'src/ui/context-menu.cpp')
| -rw-r--r-- | src/ui/context-menu.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/ui/context-menu.cpp b/src/ui/context-menu.cpp index 3655d990d..06fc6c4ef 100644 --- a/src/ui/context-menu.cpp +++ b/src/ui/context-menu.cpp @@ -19,6 +19,7 @@ #include "desktop.h" #include "document.h" #include "document-undo.h" +#include "inkscape.h" #include "message-stack.h" #include "preferences.h" #include "verbs.h" @@ -437,6 +438,7 @@ static void sp_image_image_edit(GtkMenuItem *menuitem, SPAnchor *anchor) GError* errThing = 0; Glib::ustring cmdline = getImageEditorName(); + Glib::ustring name; Glib::ustring fullname; #ifdef WIN32 @@ -448,7 +450,7 @@ static void sp_image_image_edit(GtkMenuItem *menuitem, SPAnchor *anchor) if ( index < 0 ) index = cmdline.find(".com"); if ( index >= 0 ) { Glib::ustring editorBin = cmdline.substr(0, index + 4).c_str(); - Glib::ustring args = cmdline.substr(index + 4, cmdline.length()).c_str(); + Glib::ustring args = cmdline.substr(index + 4, cmdline.length()).c_str(); editorBin.insert(0, "'"); editorBin.append("'"); cmdline = editorBin; @@ -462,20 +464,30 @@ static void sp_image_image_edit(GtkMenuItem *menuitem, SPAnchor *anchor) if (strncmp (href,"file:",5) == 0) { // URI to filename conversion - fullname = g_filename_from_uri(href, NULL, NULL); + name = g_filename_from_uri(href, NULL, NULL); } else { - fullname.append(href); + name.append(href); } - + + + if (Glib::path_is_absolute(name)) { + fullname = name; + } else if (SP_ACTIVE_DOCUMENT->getBase()) { + fullname = Glib::build_filename(SP_ACTIVE_DOCUMENT->getBase(), name); + } else { + fullname = Glib::build_filename(Glib::get_current_dir(), name); + } + + cmdline.append(" '"); cmdline.append(fullname.c_str()); cmdline.append("'"); - //printf("##Command line: %s\n", cmdline.c_str()); + //g_warning("##Command line: %s\n", cmdline.c_str()); g_spawn_command_line_async(cmdline.c_str(), &errThing); - + if ( errThing ) { g_warning("Problem launching editor (%d). %s", errThing->code, errThing->message); SPDesktop *desktop = (SPDesktop*)g_object_get_data(G_OBJECT(menuitem), "desktop"); |
