Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion inno.iss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ DisableDirPage=auto
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
DirExistsWarning=no
MinVersion=6.2.9200

[Files]
Source: "{#MainJarFile}"; DestDir: "{app}"; Flags: ignoreversion
Expand Down Expand Up @@ -127,6 +128,14 @@ end;

procedure RenameJRE;
begin
if DirExists(ExpandConstant('{app}\\jre')) then begin
Log('Deleting old jre directory');
if not DelTree(ExpandConstant('{app}\\jre'), True, True, True) then begin
Log('Failed to delete old jre folder');
Exit;
end;
Comment on lines +133 to +136
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When DelTree fails to delete the old JRE folder, the script logs the error and then calls Exit;, which terminates the RenameJRE procedure. This is a good step to prevent further operations on a potentially problematic directory state. However, this critical failure isn't directly communicated to the user. The main installation process might appear to complete successfully, but the JRE (a crucial component) would not be set up correctly, potentially leading to a non-functional application.

Could we consider adding a user-facing error message before exiting the procedure? This would provide better feedback and help the user understand why the application might not work post-installation.

For example, you could use MsgBox:

    if not DelTree(ExpandConstant('{app}\jre'), True, True, True) then begin
      Log('Failed to delete old jre folder');
      MsgBox('Setup failed to remove the existing JRE folder. This might be due to files being in use. Please ensure the application is closed and try reinstalling. The application may not function correctly.', mbError, MB_OK);
      Exit; // Or consider Abort(); to stop the entire installation
    end;

Calling Abort(); after the MsgBox would terminate the entire setup process, which might be more appropriate if a failed JRE setup renders the application unusable. This would provide clearer feedback to the user about the installation status.

    if not DelTree(ExpandConstant('{app}\jre'), True, True, True) then begin
      Log('Failed to delete old jre folder');
      MsgBox('Setup failed to remove the existing JRE folder. This might be due to files being in use. Please ensure the application is closed and try reinstalling. The application may not function correctly.', mbError, MB_OK);
      Exit; // Or consider Abort(); to stop the entire installation if this failure is critical
    end;

end;

Log('Renaming jre directory');
if not RenameFile(ExpandConstant('{app}\\{#JREFolder}'), ExpandConstant('{app}\\jre')) then begin
Log('Failed to rename jre folder');
Expand Down Expand Up @@ -252,6 +261,10 @@ Filename: "{tmp}\7za.exe"; Parameters: "x -y {tmp}\jre.zip"; WorkingDir: "{app}"
Filename: "{app}\jre\bin\javaw.exe"; Parameters: "-Xmx512M -jar ""{app}\{#MainJarFile}"""; Description: "{cm:LaunchProgram,{#AppName}}"; Flags: nowait postinstall skipifsilent

[UninstallDelete]
; Installer files
Type: filesandordirs; Name: "{app}\jre"
Type: filesandordirs; Name: "{userappdata}\.minecraft\{#AppDir}"
Type: filesandordirs; Name: "{userappdata}\.minecraft\{#AppDir}\javafx"
Type: filesandordirs; Name: "{userappdata}\.minecraft\{#AppDir}\javafx"
; Installer + Launcher files
Type: filesandordirs; Name: "{userappdata}\.minecraft\launcher_profiles.json.skbak"
Type: filesandordirs; Name: "{userappdata}\.minecraft\sklauncher-fx.jar"