summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-01-04 05:52:44 +0100
committerArno <arno@disconnect.de>2018-01-04 05:52:44 +0100
commit3213b4b32cd6620f88c6db442ebc38753b368441 (patch)
tree3396524622a9dd4bbfcd8d46412dfbe65e6e53e8 /helper.cpp
parentbd839541a0c556576415c721132d71205766755a (diff)
downloadShemovCleaner-3213b4b32cd6620f88c6db442ebc38753b368441.tar.gz
ShemovCleaner-3213b4b32cd6620f88c6db442ebc38753b368441.tar.bz2
ShemovCleaner-3213b4b32cd6620f88c6db442ebc38753b368441.zip
Improve lookup of cache dir
Implement looking up the cache dir as Helper::function. Create it if it doesn't exist.
Diffstat (limited to 'helper.cpp')
-rw-r--r--helper.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/helper.cpp b/helper.cpp
index a895ec4..502bfac 100644
--- a/helper.cpp
+++ b/helper.cpp
@@ -9,6 +9,8 @@
#include <QProcess>
#include <QFontMetrics>
#include <QPainter>
+#include <QStandardPaths>
+#include <QDir>
#include "helper.h"
@@ -122,6 +124,18 @@ namespace Helper {
return retval;
}
+ const QString appDataDir(){
+ QString retval = QStandardPaths::locate(QStandardPaths::HomeLocation, ".shemovcleaner", QStandardPaths::LocateDirectory);
+ if(retval.isEmpty()){
+ QString homeDir = QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::LocateDirectory);
+ QDir d(homeDir);
+ if(d.mkdir(".shemovcleaner")){
+ retval = QString("%1/%2").arg(homeDir).arg(".shemovcleaner");
+ }
+ }
+ return retval;
+ }
+
Duration::Duration() : mHours(0), mMinutes(0), mSeconds(0) {}
Duration::Duration(qint64 seconds){