summaryrefslogtreecommitdiff
path: root/common.cpp
diff options
context:
space:
mode:
authorArseniy-Movshev <dodoradio@outlook.com>2023-07-23 00:28:58 +0100
committerArseniy-Movshev <dodoradio@outlook.com>2023-07-23 00:37:48 +0100
commit3ccc7bf59b1547d6250cdfaa1fce63828869c854 (patch)
tree9ea88eac750d32e374864ab2507c949a226db6cd /common.cpp
parent83b19141c731aa035891433e2e4d72ec303ca7df (diff)
Moved setupFilePath to common from logger
This function may need to be used from qml
Diffstat (limited to 'common.cpp')
-rw-r--r--common.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/common.cpp b/common.cpp
index 10c18d4..71524dc 100644
--- a/common.cpp
+++ b/common.cpp
@@ -12,6 +12,7 @@
#include <QStandardPaths>
#include <QFile>
#include <QDebug>
+#include <QDir>
#include "common.h"
QString fileNameForDate(QDate date, QString prefix) {
@@ -36,3 +37,8 @@ void fileAddRecord(QString sensorPrefix, QString logdata, QDateTime recordTime)
out << QString::number(recordTime.currentSecsSinceEpoch()) + ":" + logdata + "\n";
file.close();
}
+
+void setupFilePath(QString sensorPrefix) {
+ QSettings settings("asteroid","sensorlogd"); //this should be moved out of here at some point TODO
+ QDir::root().mkpath(settings.value("loggerRootPath",QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.asteroid-sensorlogd/").toString() + sensorPrefix);
+}