Add red data removal checkbox to uninstaller
Optional checkbox in bold red: REMOVE ALL USER DATA (BOOKMARKS, CACHE, LIBRARY — DATA LOSS). Unchecked by default. Deletes %APPDATA%/booru-viewer if checked.
This commit is contained in:
parent
8ebed2f281
commit
f6452683ff
@ -27,3 +27,38 @@ Name: "desktopicon"; Description: "Create desktop shortcut"; GroupDescription: "
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\booru-viewer.exe"; Description: "Launch booru-viewer"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[Code]
|
||||
var
|
||||
RemoveDataCheckbox: TNewCheckBox;
|
||||
|
||||
procedure InitializeUninstallProgressForm();
|
||||
var
|
||||
UninstallPage: TNewStaticText;
|
||||
begin
|
||||
RemoveDataCheckbox := TNewCheckBox.Create(UninstallProgressForm);
|
||||
RemoveDataCheckbox.Parent := UninstallProgressForm;
|
||||
RemoveDataCheckbox.Left := 10;
|
||||
RemoveDataCheckbox.Top := UninstallProgressForm.ClientHeight - 50;
|
||||
RemoveDataCheckbox.Width := UninstallProgressForm.ClientWidth - 20;
|
||||
RemoveDataCheckbox.Height := 20;
|
||||
RemoveDataCheckbox.Caption := 'REMOVE ALL USER DATA (BOOKMARKS, CACHE, LIBRARY — DATA LOSS)';
|
||||
RemoveDataCheckbox.Font.Color := clRed;
|
||||
RemoveDataCheckbox.Font.Style := [fsBold];
|
||||
RemoveDataCheckbox.Checked := False;
|
||||
end;
|
||||
|
||||
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
||||
var
|
||||
AppDataDir: String;
|
||||
begin
|
||||
if CurUninstallStep = usPostUninstall then
|
||||
begin
|
||||
if RemoveDataCheckbox.Checked then
|
||||
begin
|
||||
AppDataDir := ExpandConstant('{userappdata}\booru-viewer');
|
||||
if DirExists(AppDataDir) then
|
||||
DelTree(AppDataDir, True, True, True);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user