Experience
Projects
My Stack
Case studies
Contact me
Open my CV

·4 min read

The DiskDesk uninstaller asked a question that no silent update can answer

The prompt in DiskDesk's uninstaller is a reasonable question: do you want your settings and icon layout deleted too? It is a bad question when nobody is there to answer it. The in-app updater runs installers silently, and a dialog that waits for a click has no business in that path.

Project
DiskDesk
Date
Sep 2026
Stack
Python, Inno Setup, GitHub Actions
Commit
410f9f2

Two ways the installer gets run

DiskDesk ships two ways: a per-user installer built with Inno Setup, and a portable exe. The installer is per-user on purpose. The header of installer/diskdesk.iss says it installs under %LOCALAPPDATA%\Programs\DiskDesk with no administrator prompt, "which is also what lets the in-app updater run the new installer silently".

The updater lives in diskdesk/update.py. The apply function has two branches. An installed copy hands over to the downloaded installer with flags:

python
subprocess.Popen([path, "/SILENT", "/SUPPRESSMSGBOXES", "/NORESTART",
                  "/CLOSEAPPLICATIONS", "/RESTARTAPPLICATIONS"],
                 close_fds=True)

The docstring describes the intent: an installer is run "with the flags that keep it silent apart from its progress window". A portable exe cannot overwrite itself while running, so that branch writes a one-shot swap.cmd that waits for DiskDesk to exit, renames the old exe, moves the new one into place and relaunches.

The installer script knows about the silent flow too. A [Run] entry restarts DiskDesk after a silent update, guarded by a function that checks both that setup is silent and that /RESTARTAPPLICATIONS is on the command line:

pascal
function WantsSilentRestart(): Boolean;
begin
  Result := WizardSilent() and (Pos('/RESTARTAPPLICATIONS', UpperCase(GetCmdTail)) > 0);
end;

A marker file, installed.txt, tells the updater that this copy was installed, so it fetches the installer and not the portable exe.

The question in the uninstaller

The uninstaller has one custom step. After files are removed, it checks whether the settings folder under %APPDATA%\DiskDesk exists and asks:

pascal
if MsgBox('Remove your DiskDesk settings and saved icon layout?' + #13#10 +
          'Your desktop folder and its files are never touched.',
          mbConfirmation, MB_YESNO) = IDYES then
  DelTree(Settings, True, True, True);

Interactively this is right. Uninstalling a desktop tool should offer to clean up after itself, and the wording makes clear the user's own desktop files are never at stake. The README mentions it as well: uninstalling offers to remove your settings.

The problem is that CurUninstallStepChanged runs for every uninstall, including one started with a silent flag. My comment in the fix says what I concluded: a silent uninstall "which is also how an unattended update runs" must never stop for a question. I did not trace a reported hang or a deleted settings folder. This is a fix from reading the code path, not from a bug report, and I would rather say that than invent an incident.

What the fix changes

The diff is one condition:

diff
-  if CurUninstallStep = usPostUninstall then
+  if (CurUninstallStep = usPostUninstall) and not UninstallSilent then

UninstallSilent is Inno Setup's function for whether the uninstaller was started silently. When it is true, the whole block is skipped, so no dialog appears and the settings stay where they are.

I did not want to depend on what an automatic answer to the box would be. /SUPPRESSMSGBOXES is already in the updater's flag list, but relying on a suppression default to pick between deleting and keeping the user's data is the wrong layer to decide it. Deciding in the script, explicitly, means the behavior is written down where the question is asked.

Why keep, not delete

The choice of default is the real decision here. When nobody can answer, there are two options, and they are not symmetric. Leaving the settings folder behind costs a few kilobytes of files that the next install will pick up again, which is what you want if the "uninstall" was part of an update. Deleting it means the user opens the new version and finds their saved icon layout gone, with no way to bring it back. An unattended path should make the reversible choice.

A manual uninstall from Windows settings is unchanged: the prompt is still there, and a person can still say yes.

The same day brought two small release-pipeline commits. 3b8509f makes the workflow reuse an existing release when a tag is pushed by hand, and ce2fe5b quotes the Program Files (x86) path for pwsh in CI. Neither is about the uninstaller, but together they are what building an installer that is meant to be run unattended looks like: the paths that no one watches are the ones that need to be explicit.

What I took from it

Every dialog in an installer is a decision that someone has to be present to make. List them against the paths where nobody is present, and for each one, decide in code what happens instead, with the harmless option as the default. The fix was a single line. Finding it meant reading the updater and the installer side by side, which I had not done when I wrote the prompt.

#inno-setup#installer#updater#windows

Keep reading

Have a project in mind?