Repository navigation
Purge verified files on macOS and Linux - #1011
Merged
Merged
Conversation
The two heads had no purge, since it needs a folder picker and neither has a toolkit. They now ask through a program the desktop has, as DesktopNotification pops a balloon: AppleScript's choose folder and display dialog on macOS, and on Linux zenity, or kdialog on KDE, either standing in for the other. With neither installed the item is not on the menu. DesktopPurge runs on a thread of its own, since each question waits on the person and the menu's thread is the tray loop's, which on macOS is AppKit's. A file it cannot delete is counted and the rest deleted, and a notification says what came of it; the Windows head still asks about each failure, since there it can be a file held open. What a purge finds and deletes moves out of the Windows head's FilePurger into the core's VerifiedFiles, and the delete asks the restart manager only on Windows, which is the only place it exists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"Purge verified files" was Windows only, because it needs a folder picker and the macOS and Linux heads have no toolkit.
The change.
DesktopDialogasks a purge's two questions, the folder and the go ahead, through a program the desktop has, as PlatformHeads'DesktopNotificationpops a balloon:choose folderanddisplay dialog, byosascript.XDG_CURRENT_DESKTOP), either standing in for the other.Values go as arguments, never into a script's text, and zenity is given
--no-markup, so a path with a quote,&or<in it arrives as it is.With no program to ask with (a Linux desktop with neither),
Purgeis null and the item is not on the menu, as before.DesktopPurgeruns on a thread of its own, one at a time. Each question waits on the person, and the menu's thread is the tray loop's, which on macOS is AppKit's main thread.A file it cannot delete is counted and the rest deleted, and a notification says how many went and what stopped the first that didn't. The Windows head still asks Abort/Retry/Ignore for each failure, since there it can be a file held open.
Findand the delete move from the Windows head'sFilePurgerinto the core'sVerifiedFiles, which both use. The delete now asks the restart manager only on Windows: off Windowsrstrtmgr.dllisn't there, and the call would have thrown.Docs: the tray page's Purge section covers every platform, and it describes what purge actually deletes,
*.received.*as well as*.verified.*. It's on the macOS and Linux menu list now, not the "not there" list. CLAUDE.md is updated to match.Tests.
DesktopPurgeTestsdrives the flow with stand-in questions:DesktopDialogTestssnapshots each program's arguments, and checks which program each desktop gets and how a printed folder is read back.Locally on Windows, a Release build had no errors. DiffEngineTray.Core.Tests passed 317 with 4 skipped, and DiffEngineTray.Tests passed 106,
FilePurgerTestincluded, against the moved code.Not seen working. No dialog was put up for real. macOS can't be run from here, and Linux would need a desktop session. The parts that can be checked without one are what the tests cover.