diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2018-12-13 13:30:04 -0600 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2018-12-13 13:30:04 -0600 |
| commit | e63eba2ca1c0ac0d862275168157e9382f05a945 (patch) | |
| tree | c4a09227e9a991d2d73f64fbe0632e9fd38348f0 /src/installationmanager.cpp | |
| parent | 20008e17b71f3b23f94893554b3623b2d4f732d6 (diff) | |
Improve cleanup of temporary files when installing
Diffstat (limited to 'src/installationmanager.cpp')
| -rw-r--r-- | src/installationmanager.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
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()); } |
