Created
March 20, 2016 23:39
-
-
Save jakoch/f9340f85a029b3adf253 to your computer and use it in GitHub Desktop.
InnoSetup Uninstall by deleting the application folder
This file contains 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
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); | |
begin | |
// warn the user, that his working folder is going to be deleted and projects might get lost | |
if (CurUninstallStep = usUninstall) then begin | |
if MsgBox('***WARNING***'#13#10#13#10 + | |
'The installation folder is [ '+ ExpandConstant('{app}') +' ].'#13#10 + | |
'You are about to delete this folder and all its subfolders,'#13#10 + | |
'including [ '+ ExpandConstant('{app}') +'\important_projects_folder ], which may contain your projects.'#13#10#13#10 + | |
'This is your last chance to do a backup of your files.'#13#10#13#10 + | |
'Do you want to proceed?'#13#10, mbConfirmation, MB_YESNO) = IDYES | |
then begin | |
// User clicked: YES | |
// fix "read-only" status of all files and folders, else some things might remain after uninstallation | |
ExecHidden('cmd.exe /c "attrib -R ' + appDir + '\*.* /s /d"'); | |
// Deletes the application directory and everything inside it. | |
// This function will remove directories that are reparse points, | |
// but it will not recursively delete files/directories inside them. | |
DelTree(ExpandConstant('{app}'), True, True, True); | |
end else begin | |
// User clicked: No | |
Abort; | |
end; | |
end; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment