Skip to content

Purge verified files on macOS and Linux - #1011

Merged
SimonCropp merged 1 commit into
mainfrom
purge-on-unix
Oct 31, 2026
Merged

SimonCropp merged 1 commit into
mainfrom
purge-on-unix

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

"Purge verified files" was Windows only, because it needs a folder picker and the macOS and Linux heads have no toolkit.

The change.

  • DesktopDialog asks a purge's two questions, the folder and the go ahead, through a program the desktop has, as PlatformHeads' DesktopNotification pops a balloon:

    • macOS: AppleScript's choose folder and display dialog, by osascript.
    • Linux: zenity, or kdialog on KDE (by 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), Purge is null and the item is not on the menu, as before.

  • DesktopPurge runs 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.

  • Find and the delete move from the Windows head's FilePurger into the core's VerifiedFiles, which both use. The delete now asks the restart manager only on Windows: off Windows rstrtmgr.dll isn'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.

  • DesktopPurgeTests drives the flow with stand-in questions:
    • deletes what it finds once confirmed;
    • deletes nothing when not confirmed;
    • asks nothing more when no folder is chosen;
    • says so when nothing is found;
    • counts a file it couldn't delete: read only on Windows, a folder that can't be written to on Unix.
  • DesktopDialogTests snapshots each program's arguments, and checks which program each desktop gets and how a printed folder is read back.
  • Both run in the unix job too.

Locally on Windows, a Release build had no errors. DiffEngineTray.Core.Tests passed 317 with 4 skipped, and DiffEngineTray.Tests passed 106, FilePurgerTest included, 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.

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.
@SimonCropp
SimonCropp merged commit 714b797 into main Oct 31, 2026
15 checks passed
@SimonCropp
SimonCropp deleted the purge-on-unix branch October 31, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant