mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									5377706aca
								
							
						
					
					
						commit
						74d1afc0d5
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -14,6 +14,7 @@ | ||||||
| #include <QTimer> | #include <QTimer> | ||||||
| #include <QDateTime> | #include <QDateTime> | ||||||
| #include <QClipboard> | #include <QClipboard> | ||||||
|  | #include <QFile> | ||||||
| 
 | 
 | ||||||
| #include <QBluetoothLocalDevice> | #include <QBluetoothLocalDevice> | ||||||
| 
 | 
 | ||||||
|  | @ -155,6 +156,9 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), | ||||||
| 	appLogFileName = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first() + "/subsurface.log"; | 	appLogFileName = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first() + "/subsurface.log"; | ||||||
| 	QString libdcLogFileName = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first() + "/libdivecomputer.log"; | 	QString libdcLogFileName = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first() + "/libdivecomputer.log"; | ||||||
| #endif | #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); | 	logfile_name = copy_qstring(libdcLogFileName); | ||||||
| 	appLogFile.setFileName(appLogFileName); | 	appLogFile.setFileName(appLogFileName); | ||||||
| 	if (!appLogFile.open(QIODevice::ReadWrite|QIODevice::Truncate)) { | 	if (!appLogFile.open(QIODevice::ReadWrite|QIODevice::Truncate)) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue