index 19d770af0af04e968ff483607fcc11b86fb521da..a3589e9051556fe27c523cd368df1b79dfda34b1 100644 (file)
\param doc Document to save.
\param uri The filename to save the file to.
- This function first checks it's parameters, and makes sure that
+ This function first checks its parameters, and makes sure that
we're getting good data. It also checks the module ID of the
- incoming module to figure out if this is save should include
+ incoming module to figure out whether this save should include
the Inkscape namespace stuff or not. The result of that comparison
is stored in the spns variable.
all of this code. I just stole it.
*/
void
-Svg::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gchar *uri)
+Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename)
{
g_return_if_fail(doc != NULL);
- g_return_if_fail(uri != NULL);
+ g_return_if_fail(filename != NULL);
- gchar *save_path = g_path_get_dirname (uri);
+ gchar *save_path = g_path_get_dirname(filename);
- gboolean const spns = (!mod->get_id()
+ bool const spns = ( !mod->get_id()
|| !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)
|| !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE));
@@ -209,13 +209,11 @@ Svg::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gchar *uri)
} else {
rdoc = sp_repr_document_new ("svg:svg");
repr = rdoc->root();
- repr = sp_document_root (doc)->updateRepr(repr, SP_OBJECT_WRITE_BUILD);
+ repr = sp_document_root (doc)->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD);
}
- Inkscape::IO::fixupHrefs( doc, save_path, spns );
-
- gboolean const s = sp_repr_save_file (repr->document(), uri, SP_SVG_NS_URI);
- if (s == FALSE) {
+ if (!sp_repr_save_rebased_file(repr->document(), filename, SP_SVG_NS_URI,
+ doc->base, filename)) {
throw Inkscape::Extension::Output::save_failed();
}