From ddb8af8009f151c7107daf0c2127f0ba2d882649 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Fri, 24 Jan 2014 20:05:26 -0500 Subject: Move absolute path generator to URI and use std::strings (bzr r12977) --- src/uri.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/uri.cpp') diff --git a/src/uri.cpp b/src/uri.cpp index de6a454ec..8d0e49139 100644 --- a/src/uri.cpp +++ b/src/uri.cpp @@ -10,7 +10,9 @@ #include #include "uri.h" +#include #include +#include namespace Inkscape { @@ -134,6 +136,17 @@ gchar *URI::to_native_filename(gchar const* uri) throw(BadURIException) return filename; } +const std::string URI::getFullPath(std::string const base) const { + std::string path = std::string(_impl->getPath()); + // Calculate the absolute path from an available base + if(!path.empty() && !base.empty() && path.compare(0, 1, "/") != 0) { + path = Glib::build_filename(base, path); + } + // TODO: Check existance of file here + return path; +} + + /* TODO !!! proper error handling */ gchar *URI::toNativeFilename() const throw(BadURIException) { gchar *uriString = toString(); -- cgit v1.2.3