diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-01-27 22:03:02 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-01-27 22:03:02 +0000 |
| commit | 5b962cdfdae8e7fee34211f7da4146eba5d763f9 (patch) | |
| tree | 7ca839f8b4e6f2e67ed86915ba61641c0a10d714 /src/uri-references.cpp | |
| parent | update to trunk (diff) | |
| parent | Protect pdf and png exports from failure and output reasonalbe warnings. (diff) | |
| download | inkscape-5b962cdfdae8e7fee34211f7da4146eba5d763f9.tar.gz inkscape-5b962cdfdae8e7fee34211f7da4146eba5d763f9.zip | |
update to trunk
(bzr r11950.1.237)
Diffstat (limited to 'src/uri-references.cpp')
| -rw-r--r-- | src/uri-references.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/uri-references.cpp b/src/uri-references.cpp index 718b2d451..abe16ec9d 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -57,20 +57,18 @@ void URIReference::attach(const URI &uri) throw(BadURIException) } // The path contains references to seperate document files to load. - const char *path = uri.getPath(); - if(path) { - if(document != NULL) { - // Calculate the absolute path from an available document - std::string basePath = std::string( document->getBase() ); - std::string absPath = Glib::build_filename(basePath, std::string( path ) ); - path = absPath.c_str(); - } - // TODO: This is inefficient because it will load the same svg file - // many times if it's used many times. A global list of documents would - // be useful for tracking linked items. - document = SPDocument::createNewDoc(path, FALSE); + if(document && uri.getPath()) { + std::string base = std::string(document->getBase()); + std::string path = uri.getFullPath(base); + if(!path.empty()) + document = document->createChildDoc(path); + else + document = NULL; + } + if(!document) { + g_warning("Can't get document for referenced URI: %s", uri.toString()); + return; } - g_return_if_fail(document != NULL); gchar const *fragment = uri.getFragment(); if ( !uri.isRelative() || uri.getQuery() || !fragment ) { |
