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
This commit is contained in:
Albert Vaca 2017-02-18 16:14:51 +01:00
parent 1b308a547d
commit b75d52fe31
3 changed files with 6 additions and 13 deletions

View file

@ -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();

View file

@ -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
*/

View file

@ -23,6 +23,7 @@
#include <QDBusConnection>
#include <QDir>
#include <QDebug>
#include <QStandardPaths>
#include <KLocalizedString>
#include <KNotification>
@ -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()