From b75d52fe3130d8c659c541562a58049211510157 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sat, 18 Feb 2017 16:14:51 +0100 Subject: [PATCH] Do not use a location under home as mount point Try to use XDG_RUNTIME_DIR and fall back to /tmp. https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html --- core/kdeconnectpluginconfig.cpp | 5 ----- core/kdeconnectpluginconfig.h | 6 ------ plugins/sftp/sftpplugin.cpp | 8 ++++++-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/core/kdeconnectpluginconfig.cpp b/core/kdeconnectpluginconfig.cpp index 8c9750d16..9f33d571e 100644 --- a/core/kdeconnectpluginconfig.cpp +++ b/core/kdeconnectpluginconfig.cpp @@ -51,11 +51,6 @@ KdeConnectPluginConfig::~KdeConnectPluginConfig() delete d->mConfig; } -QDir KdeConnectPluginConfig::privateDirectory() -{ - return d->mConfigDir; -} - QVariant KdeConnectPluginConfig::get(const QString& key, const QVariant& defaultValue) { d->mConfig->sync(); diff --git a/core/kdeconnectpluginconfig.h b/core/kdeconnectpluginconfig.h index 0f2dcbde9..a13d0041b 100644 --- a/core/kdeconnectpluginconfig.h +++ b/core/kdeconnectpluginconfig.h @@ -39,12 +39,6 @@ public: KdeConnectPluginConfig(const QString& deviceId, const QString& pluginName); ~KdeConnectPluginConfig() override; - /** - * A directory to store stuff for this device and plugin. It's private in the sense - * of not-shared with other plugins or devices, not from a security point of view. - */ - QDir privateDirectory(); - /** * Store a key-value pair in this config object */ diff --git a/plugins/sftp/sftpplugin.cpp b/plugins/sftp/sftpplugin.cpp index 196ce39ed..d629a1938 100644 --- a/plugins/sftp/sftpplugin.cpp +++ b/plugins/sftp/sftpplugin.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -151,8 +152,11 @@ bool SftpPlugin::receivePackage(const NetworkPackage& np) QString SftpPlugin::mountPoint() { - QDir mountDir = config()->privateDirectory(); - return mountDir.absoluteFilePath(deviceId); + QString runtimePath = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); + if (runtimePath.isEmpty()) { + runtimePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); + } + return QDir(runtimePath).absoluteFilePath(deviceId); } void SftpPlugin::onMounted()