From 4ac375834cc3e246f8636ffc376b35691b344ebc Mon Sep 17 00:00:00 2001 From: Simon Schmeisser Date: Sun, 5 Nov 2023 02:19:20 +0100 Subject: [PATCH] Use current user's homedir as `Phone memory` path (#46) Closes #15 This should return the current user's home directory instead of hard-coding it. Documentation reference: https://doc.qt.io/qt-5/qstandardpaths.html Alternatively, [`QDir::homePath](https://doc.qt.io/qt-5/qdir.html#homePath) can be used. (not actually tested) --- src/config.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config.cpp b/src/config.cpp index bdecf8b..164426f 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -1,6 +1,7 @@ #include "config.h" #include +#include QSettings sets("cepiperez", "fileboxplus"); @@ -29,5 +30,5 @@ void Config::removeConfig(QString data1) QString Config::getHome() { - return readConfig("PhoneMemoryFolder", "/home/defaultuser"); + return QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first(); }