Skip to content

Commit

Permalink
innosetup: fix invalid drive error with missing installs
Browse files Browse the repository at this point in the history
When the innosetup app path in the registry points to an invalid
location, like a drive which no longer exists, setup breaks because it
is unable to install to the location, but also the uninstaller no longer
exists too and so it can't be uninstalled. This forces the user to fix
it via editing the registry.

This could be worked around with DisableDirPage=no, which always forces
the dir page to be shown. But this would allow users to install multiple
times to different places, which is not desirable.

Reset the dir path if it is pointed to a non-default location which
doesn't exist. Note the dir page is still not shown in this case, but at
least it will fix the install enough to let the user uninstall it again
if they want to move it to a different location.
  • Loading branch information
Adam- committed Oct 30, 2023
1 parent baf8f4c commit 19f00ae
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
18 changes: 18 additions & 0 deletions innosetup/dircheck.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
procedure InitializeWizard();
var
defaultPath: String;
currentPath: String;
begin
defaultPath := ExpandConstant('{localappdata}\RuneLite');
{ this defaults to the current installed location read from the registry }
currentPath := GetWizardForm.DirEdit.Text;
if defaultPath <> currentPath then begin
if not DirExists(currentPath) then begin
{ Already installed to a non-default location which doesn't exist.
It is not possible to make the installer reenable the dir page here,
but we can at least reset the install location. }
Log(Format('Resetting diredit path to %s', [defaultPath]))
GetWizardForm.DirEdit.Text := defaultPath
end
end
end;
3 changes: 2 additions & 1 deletion innosetup/runelite.iss
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ Type: filesandordirs; Name: "{app}"

[Code]
#include "upgrade.pas"
#include "usernamecheck.pas"
#include "usernamecheck.pas"
#include "dircheck.pas"
3 changes: 2 additions & 1 deletion innosetup/runelite32.iss
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ Type: filesandordirs; Name: "{app}"

[Code]
#include "upgrade.pas"
#include "usernamecheck.pas"
#include "usernamecheck.pas"
#include "dircheck.pas"
3 changes: 2 additions & 1 deletion innosetup/runeliteaarch64.iss
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ Type: filesandordirs; Name: "{app}"

[Code]
#include "upgrade.pas"
#include "usernamecheck.pas"
#include "usernamecheck.pas"
#include "dircheck.pas"

0 comments on commit 19f00ae

Please sign in to comment.