-
Notifications
You must be signed in to change notification settings - Fork 890
Fix #7009: Remove leftover .msi and msi.log after update #8980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| * SPDX-License-Identifier: GPL-2.0-or-later | ||
| */ | ||
|
|
||
| #include "theme.h" | ||
| #include "configfile.h" | ||
| #include "common/utility.h" | ||
| #include "accessmanager.h" | ||
|
|
@@ -304,8 +304,21 @@ | |
| ConfigFile cfg; | ||
| QSettings settings(cfg.configFile(), QSettings::IniFormat); | ||
| QString updateFileName = settings.value(updateAvailableC).toString(); | ||
| if (!updateFileName.isEmpty()) | ||
| QFile::remove(updateFileName); | ||
| if (!updateFileName.isEmpty()) { | ||
| if (QFile::remove(updateFileName)) { | ||
| qCInfo(lcUpdater) << "Removed updater file:" << updateFileName; | ||
| } else { | ||
| qCWarning(lcUpdater) << "Failed to remove updater file:" << updateFileName; | ||
| } | ||
| } | ||
| // Also try to remove the msi log file (created when running msiexec) | ||
| QString msiLogFileName = cfg.configPath() + "msi.log"; | ||
| if (QFile::remove(msiLogFileName)) { | ||
| qCInfo(lcUpdater) << "Removed msi log file:" << msiLogFileName; | ||
| } else { | ||
| qCWarning(lcUpdater) << "Failed to remove msi log file:" << msiLogFileName; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be good to check whether the current platform is Windows? I wouldn't expect an msi log on any other system.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @Aiiaiiio, thanks for the suggestion! From what I see, the changes are in NSISUpdater::wipeUpdateData() which is a Windows-specific subclass of OCUpdater. So this code isn’t compiled on other platforms than Windows and no additional platform check should be needed. |
||
| } | ||
|
|
||
| settings.remove(updateAvailableC); | ||
| settings.remove(updateTargetVersionC); | ||
| settings.remove(updateTargetVersionStringC); | ||
|
|
@@ -522,6 +535,13 @@ | |
| return false; | ||
| } | ||
| } else { | ||
| // No internal updater was executed (possible manual install). | ||
| // If the app has already been upgraded externally, clean up leftover msi and log files. | ||
| if (updateSucceeded()) { | ||
| qCInfo(lcUpdater) << "Detected externally installed update - cleaning leftover msi and log files."; | ||
| wipeUpdateData(); | ||
| return false; | ||
| } | ||
| qCInfo(lcUpdater) << "Triggering an update"; | ||
| return performUpdate(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider using a constant for
msi.log.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I’ve added a separate commit introducing a constant msiLogFileNameC as suggested.