For the installation and deployment of my application I'm using Inno-Setup 5.5.4. My current installation structure is the following:
C:\MyApp
C:\MyApp\app.exe
C:\MyApp\FolderA
C:\MyApp\FolderA\InstalledFile.txt
C:\MyApp\FolderA\NewFile.txt
C:\MyApp\FolderB
C:\MyApp\FolderB\NewFile.txt
...
C:\MyApp\FolderZ
After uninstalling the application, I want to make remove all possible files that could be created by the application except those present in a specific folder. (i.e. the C:\MyApp\FolderA\NewFile.txt
).
My first try would be to have one entry for each folder I want to clean in the [UninstallDelete] section. Something like the following:
[UninstallDelete]
Type: filesandordirs; Name: C:\MyApp\FolderB
Type: filesandordirs; Name: C:\MyApp\FolderC
...
Type: filesandordirs; Name: C:\MyApp\FolderZ
However, I don't like this solution since I have to consider to modify the installer each time I add a new folder to the application.
Second approach would be to remove the specific folder only if it is empty and then set application's root folder to be removed. Something like the following:
[UninstallDelete]
Type: dirifempty; Name: C:\MyApp\FolderA
Type: filesandordirs; Name: C:\MyApp\
Would this second approach work? Is there a more reasonable way to achieve this?