From 34d2e296a45845f9241cedeafff7b23e06d8f5cf Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Sun, 9 Dec 2018 15:56:40 +0100 Subject: remove Inkscape::URI::getFullPath --- src/object/uri.cpp | 46 +++++++--------------------------------------- 1 file changed, 7 insertions(+), 39 deletions(-) (limited to 'src/object/uri.cpp') diff --git a/src/object/uri.cpp b/src/object/uri.cpp index 5f9a38c5f..f6d044a6e 100644 --- a/src/object/uri.cpp +++ b/src/object/uri.cpp @@ -216,48 +216,16 @@ const gchar *URI::Impl::getOpaque() const { return nullptr; } -/* - * Returns the absolute path to an existing file referenced in this URI, - * if the uri is data, the path is empty or the file doesn't exist, then - * an empty string is returned. - * - * Does not check if the returned path is the local document's path (local) - * and thus redundent. Caller is expected to check against the document's path. - * - * @param base directory name to use as base if this is not an absolute URL - */ -const std::string URI::getFullPath(std::string const &base) const { - if (!_impl->getPath()) { - return ""; - } - - URI url; - - if (!base.empty() && !getScheme()) { - url = Inkscape::URI::from_href_and_basedir(str().c_str(), base.c_str()); - } else { - url = *this; - } - - if (!url.hasScheme("file")) { - return ""; - } - - auto path = Glib::filename_from_uri(url.str()); +std::string URI::toNativeFilename() const +{ // + auto uristr = str(); - // Check the existence of the file - if(! g_file_test(path.c_str(), G_FILE_TEST_EXISTS) - || g_file_test(path.c_str(), G_FILE_TEST_IS_DIR) ) { - path.clear(); + // remove fragment identifier + if (getFragment() != nullptr) { + uristr.resize(uristr.find('#')); } - return path; -} - -/* TODO !!! proper error handling */ -std::string URI::toNativeFilename() const -{ // - return Glib::filename_from_uri(str()); + return Glib::filename_from_uri(uristr); } URI URI::fromUtf8( gchar const* path ) { -- cgit v1.2.3