From 68a13573d839f97c7c2a16da1a4fb15b7803ffa1 Mon Sep 17 00:00:00 2001 From: pjrm Date: Tue, 7 Apr 2009 08:25:43 +0000 Subject: [PATCH] Use the new sp_document_change_uri_and_hrefs function. The change to extension/system.cpp is a functional noop. The change to extension/implementation/script.cpp should fix importing of .ai files that contain images (or whatever ill2svg.pl creates png files for). The effect on any other scripts that create SVG files with relative hrefs is unknown. --- src/extension/implementation/script.cpp | 4 +++- src/extension/system.cpp | 9 +-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 70b006d31..eabf147f6 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -581,7 +581,9 @@ Script::open(Inkscape::Extension::Input *module, } // data_read if (mydoc != NULL) { - sp_document_set_uri(mydoc, filenameArg); + g_free(mydoc->base); + mydoc->base = NULL; + sp_document_change_uri_and_hrefs(mydoc, filenameArg); } // make sure we don't leak file descriptors from g_file_open_tmp diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 37b70fec8..fdebd7b22 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -257,14 +257,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); } else { /* The document is changing name/uri. */ - - /* TODO: Don't treat URIs and filenames interchangeably. - * So call g_filename_to_uri when passing to sp_document_set_uri, - * and change rebase_hrefs to accept a base URI/LEIRI instead of dir name. */ - gchar *const new_base = g_path_get_dirname(fileName); - Inkscape::XML::rebase_hrefs(doc, new_base, true); - sp_document_set_uri(doc, fileName); - g_free(new_base); + sp_document_change_uri_and_hrefs(doc, fileName); } // Update attributes: -- 2.30.2