summaryrefslogtreecommitdiffstats
path: root/src/object/uri.cpp
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2018-12-09 14:56:40 +0000
committerThomas Holder <thomas@thomas-holder.de>2018-12-09 20:50:04 +0000
commit34d2e296a45845f9241cedeafff7b23e06d8f5cf (patch)
treedea6c03ac9504dfbeebbd3671c5dd632671efcca /src/object/uri.cpp
parentFix license in new files (diff)
downloadinkscape-34d2e296a45845f9241cedeafff7b23e06d8f5cf.tar.gz
inkscape-34d2e296a45845f9241cedeafff7b23e06d8f5cf.zip
remove Inkscape::URI::getFullPath
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 ) {