Skip to content

Commit 05479a1

Browse files
warn the user the installer is deleting files
1 parent acb5e3a commit 05479a1

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

tools/installer/installer.iss

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ DisableWelcomePage=yes
1818
[Files]
1919
Source: {#DIST_PATH}\*; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
2020

21+
[InstallDelete]
22+
Type: filesandordirs; Name: "{app}"
23+
2124
[Code]
2225
const SystemEnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
2326
const UserEnvironmentKey = 'Environment';
@@ -59,8 +62,7 @@ var
5962
Paths: string;
6063
P: Integer;
6164
begin
62-
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, SystemEnvironmentKey, 'Path', Paths) then
63-
exit;
65+
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, SystemEnvironmentKey, 'Path', Paths) then exit;
6466
6567
P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
6668
if P = 0 then exit;
@@ -73,8 +75,7 @@ procedure EnvAddCEdev(CEdevNewPath: string);
7375
var
7476
CEdevPath: string;
7577
begin
76-
if RegQueryStringValue(HKEY_CURRENT_USER, UserEnvironmentKey, CEDEVKey, CEdevPath) then
77-
EnvRemovePath(CEdevPath + '\bin');
78+
if RegQueryStringValue(HKEY_CURRENT_USER, UserEnvironmentKey, CEDEVKey, CEdevPath) then EnvRemovePath(CEdevPath + '\bin');
7879
7980
RegWriteStringValue(HKEY_CURRENT_USER, UserEnvironmentKey, CEDEVKey, CEdevNewPath);
8081
end;
@@ -88,7 +89,6 @@ begin
8889
end;
8990
end;
9091
91-
9292
// https://github.com/DomGries/InnoDependencyInstaller
9393
// code to download and install Microsoft Visual C++ Runtime as needed.
9494
procedure AddDependency(const Filename, Parameters, Title, URL, Checksum: String; const ForceSuccess, InstallClean, RebootAfter: Boolean);
@@ -184,6 +184,16 @@ function PrepareToInstall(var NeedsRestart: Boolean): String;
184184
var
185185
I: Integer;
186186
begin
187+
188+
Result := '';
189+
190+
if DirExists(ExpandConstant('{app}')) then
191+
begin
192+
if SuppressibleMsgBox('The installer will now delete the destination folder (' + ExpandConstant('{app}') + '). It is recommended to back up any files inside, as they will be replaced by the installer. Continue?', mbConfirmation, MB_YESNO, IDYES) = IDNO
193+
then
194+
Result := 'Installing aborted by user.';
195+
end;
196+
187197
DelayedReboot := False;
188198
case InstallProducts of
189199
InstallError: begin

0 commit comments

Comments
 (0)