index 6442f2f7eb3638dbc66508eef550f73ab663acdc..a7828d3fc115e0bcb291b6e2fea29603c46b68d7 100644 (file)
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
#include "print.h"
#include "implementation/script.h"
#include "implementation/xslt.h"
+#include "xml/rebase-hrefs.h"
/* #include "implementation/plugin.h" */
namespace Inkscape {
SPDocument *doc = imod->open(filename);
if (!doc) {
- return NULL;
+ throw Input::open_failed();
}
if (last_chance_svg) {
@@ -250,12 +251,13 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension,
bool saved_modified = false;
gchar *saved_output_extension = NULL;
gchar *saved_dataloss = NULL;
- gchar *saved_uri = NULL;
if (!official) {
saved_modified = doc->isModifiedSinceSave();
saved_output_extension = g_strdup(repr->attribute("inkscape:output_extension"));
saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss"));
- saved_uri = g_strdup(doc->uri);
+ } else {
+ /* The document is changing name/uri. */
+ sp_document_change_uri_and_hrefs(doc, fileName);
}
// Update attributes:
bool const saved = sp_document_get_undo_sensitive(doc);
sp_document_set_undo_sensitive(doc, false);
{
- // save the filename for next use
- sp_document_set_uri(doc, fileName);
// also save the extension for next use
repr->setAttribute("inkscape:output_extension", omod->get_id());
// set the "dataloss" attribute if the chosen extension is lossy
@@ -286,14 +286,12 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension,
{
repr->setAttribute("inkscape:output_extension", saved_output_extension);
repr->setAttribute("inkscape:dataloss", saved_dataloss);
- sp_document_set_uri(doc, saved_uri);
}
sp_document_set_undo_sensitive(doc, saved);
doc->setModifiedSinceSave(saved_modified);
g_free(saved_output_extension);
g_free(saved_dataloss);
- g_free(saved_uri);
}
g_free(fileName);