summaryrefslogtreecommitdiffstats
path: root/src/object/uri.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/object/uri.cpp')
-rw-r--r--src/object/uri.cpp46
1 files changed, 7 insertions, 39 deletions
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 ) {