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>
This commit is contained in:
Dirk Hohndel 2018-06-21 17:09:45 +09:00
parent 5377706aca
commit 74d1afc0d5

View file

@ -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)) {