Comment 16 for bug 168958

Revision history for this message
Thangalin (thangalin-deactivatedaccount) wrote :

Here's how to fix this issue, although a better solution is needed:

1. Download Inkscape source code.
2. Edit src/ui/dialog/export.cpp
3. Insert the following lines after line 1207:

                Glib::ustring base_filename = Glib::path_get_basename(temp_string);
                Glib::ustring path = Glib::build_filename("", base_filename);

4. Change the following line (should be moved to line 1210 now) from:

                repr->setAttribute("inkscape:export-filename", filename_ext.c_str());

to:

                repr->setAttribute("inkscape:export-filename", path.c_str());

5. Save the file.
6. Compile and install.

Now do the following:

1. Open an SVG file (e.g., drawing.svg).
2. Export it to a PNG file (e.g., drawing.png).
3. Save the SVG file.

The SVG file no longer contains the full path to "drawing.png", but should use a relative path (to the SVG file) instead.

Obviously this is a temporary fix.

A robust solution would be to introduce a checkbox option that allows "save export as relative path."

Hope it helps.