summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-06-21 17:09:45 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-06-21 17:17:35 +0900
commit74d1afc0d5cd2baa6a787864d41d742f7864029d (patch)
tree4ab66cd7ba1ef58f85b94680e4726f6038846fe5 /mobile-widgets
parent5377706aca5f46fc2fb3d2bbd2e4780402742727 (diff)
downloadsubsurface-74d1afc0d5cd2baa6a787864d41d742f7864029d.tar.gz
mobile: iOS/Android: always delete libdivecomputer.log at start
This way the user doesn't inadvertantly end up with information from a previous run of Subsurface-mobile when they copy the logs to the clipboard. Not sure we should do the same when building for desktop, so right now it's only when building for a device. Reported-by: Thomas Fänge <thomas.fange@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qmlmanager.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 8e7664229..8d4ae6314 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -14,6 +14,7 @@
#include <QTimer>
#include <QDateTime>
#include <QClipboard>
+#include <QFile>
#include <QBluetoothLocalDevice>
@@ -155,6 +156,9 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
appLogFileName = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first() + "/subsurface.log";
QString libdcLogFileName = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first() + "/libdivecomputer.log";
#endif
+ // remove the existing libdivecomputer logfile so we don't copy an old one by mistake
+ QFile libdcLog(libdcLogFileName);
+ libdcLog.remove();
logfile_name = copy_qstring(libdcLogFileName);
appLogFile.setFileName(appLogFileName);
if (!appLogFile.open(QIODevice::ReadWrite|QIODevice::Truncate)) {