From e3294602c86ba4d28a3934d7eab7f7bfd48e6d74 Mon Sep 17 00:00:00 2001
From: Akira Ohgaki <akiraohgaki@gmail.com>
Date: Tue, 27 Sep 2016 21:11:09 +0900
Subject: [PATCH] Convert path string

---
 src/handlers/xdgurl.cpp | 15 +++++++++++++++
 src/handlers/xdgurl.h   |  1 +
 2 files changed, 16 insertions(+)

diff --git a/src/handlers/xdgurl.cpp b/src/handlers/xdgurl.cpp
index b51ddd3..96790ab 100644
--- a/src/handlers/xdgurl.cpp
+++ b/src/handlers/xdgurl.cpp
@@ -58,6 +58,21 @@ QJsonObject XdgUrl::_parse()
     return meta;
 }
 
+QString XdgUrl::_convertPathString(const QString &path)
+{
+    QString newPath = path;
+    if (newPath.contains("$HOME")) {
+        newPath.replace("$HOME", Utility::File::homePath());
+    }
+    else if (newPath.contains("$XDG_DATA")) {
+        newPath.replace("$XDG_DATA", Utility::File::xdgDataHomePath());
+    }
+    else if (newPath.contains("$KDE_DATA")) {
+        newPath.replace("$KDE_DATA", Utility::File::kdeDataHomePath());
+    }
+    return newPath;
+}
+
 QJsonObject XdgUrl::_importDestinations()
 {
     QJsonObject destinations;
diff --git a/src/handlers/xdgurl.h b/src/handlers/xdgurl.h
index 6a94f50..03001b5 100644
--- a/src/handlers/xdgurl.h
+++ b/src/handlers/xdgurl.h
@@ -32,6 +32,7 @@ public:
 
 private:
     QJsonObject _parse();
+    QString _convertPathString(const QString &path);
     QJsonObject _importDestinations();
     QJsonObject _importArchiveTypes();
     bool _installPlasmapkg(const QString &path, const QString &type = "plasmoid");
-- 
GitLab