Skip to content

fix: Fix uninstall failure on permission-protected files (#89)#90

Open
LouXiaXiaoHei wants to merge 1 commit into
momenbasel:mainfrom
LouXiaXiaoHei:89-fix-unintall-err
Open

fix: Fix uninstall failure on permission-protected files (#89)#90
LouXiaXiaoHei wants to merge 1 commit into
momenbasel:mainfrom
LouXiaXiaoHei:89-fix-unintall-err

Conversation

@LouXiaXiaoHei
Copy link
Copy Markdown

What does this PR do?

Fixes #89.

When uninstalling an app, deletion through Finder AppleScript could fail on permission-protected files and only show a "Grant Full Disk Access" message.

This PR adds a fallback retry using administrator privileges when Finder AppleScript deletion fails, matching the existing orphan deletion behavior.

It also removes the app from the installed apps list when the main .app bundle has been successfully deleted, even if some protected related files fail to delete.

Type of change

  • Bug fix
  • New feature
  • Performance improvement
  • UI/UX enhancement
  • Documentation
  • Other (describe)

Testing

  • Tested on macOS Ventura (13.x)
  • Tested on macOS Sonoma (14.x)
  • Tested on macOS Sequoia (15.x)

Screenshots

Not applicable.

When uninstalling an app, Finder AppleScript deletion would fail on
permission-protected files with only a "Grant Full Disk Access" message.
Now failed files are retried with administrator privileges (matching the
orphan deletion pattern), and apps whose .app bundle is successfully
deleted are removed from the installed apps list.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Logger.shared.log("Attempting admin-privileged removal for \(failedURLs.count) files", level: .info)
DispatchQueue.global(qos: .userInitiated).async {
let adminSuccess = self.removeWithAdminPrivileges(failedURLs)
DispatchQueue.main.async {
Copy link
Copy Markdown

@darkbringer1 darkbringer1 May 12, 2026

Choose a reason for hiding this comment

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

Suggested change
DispatchQueue.main.async {
DispatchQueue.main.async { [weak self] in
guard let self else { return }

}
}

func removeSelectedFiles() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if this method is called multiple times back to back, there is a race condition might happen. A flag like a isLoading/isDeleting can be kept in class level to prevent race conditions. Also a loading indicator might be used from here as well. Flag might be used to block/disable the button or show a loading indicator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Even with Full Disk Access it can't uninstall apps

2 participants