From 3213b4b32cd6620f88c6db442ebc38753b368441 Mon Sep 17 00:00:00 2001 From: Arno Date: Thu, 4 Jan 2018 05:52:44 +0100 Subject: Improve lookup of cache dir Implement looking up the cache dir as Helper::function. Create it if it doesn't exist. --- helper.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'helper.cpp') diff --git a/helper.cpp b/helper.cpp index a895ec4..502bfac 100644 --- a/helper.cpp +++ b/helper.cpp @@ -9,6 +9,8 @@ #include #include #include +#include +#include #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){ -- cgit v1.2.3-70-g09d2