Skip to content
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

update exe uninstall to be more reliable #121

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions system/system_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ func uninstallString(installSource, extension string) string {
return un
}
default:
if strings.ToLower(v) == strings.ToLower(installSource) {
displayName, _, err := q.GetStringValue("DisplayName")
if err != nil {
continue
}
// Remove display name whitespace to conform to package name
if strings.ToLower(strings.ReplaceAll(displayName, " ", "")) == strings.ToLower(installSource) {
// Check if the value exists, move on if it doesn't
un, _, err := q.GetStringValue("QuietUninstallString")
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be if err != nil || un == "" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an assumption that if we hit an error hear(likely not exists), that un will be "". I have yet to see a case where silentinstallstring exists but has no value.

continue
}
if un == "" {
un, _, err = q.GetStringValue("UninstallString")
if err != nil {
// UninstallString not found, move on to next entry
Expand Down
Loading