summaryrefslogtreecommitdiffstats
path: root/client/x11/platform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/x11/platform.cpp')
-rw-r--r--client/x11/platform.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 473ba892..1bedb225 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -1899,11 +1899,17 @@ void Platform::get_app_data_dir(std::string& path, const std::string& app_name)
{
const char* home_dir = getenv("HOME");
- if (!home_dir) {
+ if (!home_dir || strlen(home_dir) == 0) {
throw Exception("get home dir failed");
}
path = home_dir;
+ std::string::iterator end = path.end();
+
+ while (end != path.begin() && *(end - 1) == '/') {
+ path.erase(--end);
+ }
+
path += "/.";
path += app_name;