Charles
Charles

Reputation: 2682

Uninstalling files not originally installed by INNO setup

I use Inno Setup for my product's installer/uninstaller. My software has auto-update capabilities during which time it may not only change existing binaries but may also add new ones. These are additional product files that are placed into the product's installation directory - not data files.

The Inno Setup uninstaller only knows to uninstall files by name that it originally put there at install time. Since an automatic update doesn't change either the unins000.exe or unins000.dat files that make up the uninstaller, what would be the appropriate way to delete these new product files at uninstall time?

Upvotes: 0

Views: 2887

Answers (1)

Treb
Treb

Reputation: 20271

The easiest way I see is to have a batch file in your program dir that deletes all files that were added after the installation and is executed on uninstall:

 [UninstallRun]
Filename: cleanup.cmd; WorkingDir: {app}; Flags: shellexec runminimized

UninstallRun commands are executed as the first step of the uninstallation, so this should work fine. If you are bothered by the idea of running a batch script, you can easily create your own cleanup.exe that deletes the files.

When you perform the auto update, you must also update the cleanup file, so that it includes all files that were added with the current update.

Upvotes: 2

Related Questions