When I uninstall my app with my Inno Setup uninstaller, the runtime files created in the user's AppData folder remain. Is it possible to remove them?
How to clear user's app data folders with Inno Setup?
Asked Answered
you can create a CurUninstallStepChanged routine to perform any custom action you want, like deleting files on the system during uninstall.
Take a look at this example (from this question):
procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
var
mres : integer;
begin
case CurUninstallStep of
usPostUninstall:
begin
mres := MsgBox('Do you want to delete saved files?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
if mres = IDYES then
DelTree(ExpandConstant('{userdocs}\MyApp'), True, True, True);
end;
end;
end;
But will the administrator have authorization to delete files in the user's folder? (BTW nice to see one Chapín here) –
Bibliotaph
@Jader Indeed administrator have authorization to delete any file on the system. (just run cmd.exe with elevated rights and test it yourself). What I'm not sure is how inno handle's resolving user-related constants when the installer is running in elevated mode by a different user than the one initiated the install/uninstall operation. If you want to clear all the possible AppData user's files, you have to loop trough all folders under \users anyway, so it doesn't matter which user initiated the action. Nice to recognize I'm Chapín, do you know Chapinlandia? –
Indented
I've been to Tikal =) We came from Copán driving and slept on Flores. Nice views –
Bibliotaph
@Jader Tikal is awesome, magical! Nice to know you like it. Let me know if you come close again... I'll invite you a couple of gallos ;) –
Indented
I'll let you know when I visit my sister in TGU, it's not as close as it could but at least it isn't 6000 km (Brazil where I live) –
Bibliotaph
© 2022 - 2024 — McMap. All rights reserved.