diff options
| author | Martin Owens <doctormo@gmail.com> | 2014-01-25 01:05:26 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2014-01-25 01:05:26 +0000 |
| commit | ddb8af8009f151c7107daf0c2127f0ba2d882649 (patch) | |
| tree | 7ce918b452da5860dee2f5fd5926e28a1907c71b /src/document.cpp | |
| parent | fixed user description of VS command (diff) | |
| download | inkscape-ddb8af8009f151c7107daf0c2127f0ba2d882649.tar.gz inkscape-ddb8af8009f151c7107daf0c2127f0ba2d882649.zip | |
Move absolute path generator to URI and use std::strings
(bzr r12977)
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/document.cpp b/src/document.cpp index b7f5cb097..e456f2b81 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -67,8 +67,6 @@ #include "xml/rebase-hrefs.h" #include "libcroco/cr-cascade.h" -#include <glibmm/miscutils.h> - using Inkscape::DocumentUndo; using Inkscape::Util::unit_table; @@ -480,22 +478,14 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, /** * Fetches a document and attaches it to the current document as a child href */ -SPDocument *SPDocument::createChildDoc(gchar const *uri) { - - // Calculate the absolute path from an available document - if(strncmp(uri, "/", 1)!=0) { - std::string basePath = std::string( this->getBase() ); - std::string absPath = Glib::build_filename(basePath, std::string( uri ) ); - // free uri first? - uri = absPath.c_str(); - } - +SPDocument *SPDocument::createChildDoc(std::string const uri) +{ SPDocument *parent = this; SPDocument *document = NULL; while(parent != NULL && document == NULL) { // Check myself and any parents int he chain - if(strcmp(parent->getURI(), uri)==0) { + if(uri.compare(parent->getURI())==0) { document = parent; break; } @@ -503,7 +493,7 @@ SPDocument *SPDocument::createChildDoc(gchar const *uri) { boost::ptr_list<SPDocument>::iterator iter; for (iter = parent->_child_documents.begin(); iter != parent->_child_documents.end(); ++iter) { - if(strcmp(iter->getURI(), uri)==0) { + if(uri.compare(iter->getURI())==0) { document = &*iter; break; } @@ -513,7 +503,8 @@ SPDocument *SPDocument::createChildDoc(gchar const *uri) { // Load a fresh document from the svg source. if(!document) { - document = createNewDoc(uri, false, false, this); + const char *path = g_strdup(uri.c_str()); + document = createNewDoc(path, false, false, this); } return document; } |
