From e63eba2ca1c0ac0d862275168157e9382f05a945 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Thu, 13 Dec 2018 13:30:04 -0600 Subject: Improve cleanup of temporary files when installing --- src/installationmanager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/installationmanager.cpp') diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index 64e58358..76b1e086 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -677,7 +677,14 @@ void InstallationManager::postInstallCleanup() // TODO: this doesn't yet remove directories. Also, the files may be left there if this point isn't reached for (const QString &tempFile : m_TempFilesToDelete) { QFileInfo fileInfo(QDir::tempPath() + "/" + tempFile); - QFile::remove(fileInfo.absoluteFilePath()); + if (fileInfo.exists()) { + if (!fileInfo.isReadable() || !fileInfo.isWritable()) { + QFile::setPermissions(fileInfo.absoluteFilePath(), QFile::ReadOther | QFile::WriteOther); + } + if (!QFile::remove(fileInfo.absoluteFilePath())) { + qWarning() << "Unable to delete " << fileInfo.absoluteFilePath(); + } + } directoriesToRemove.insert(fileInfo.absolutePath()); } -- cgit v1.3.1