Incorrect installation when R installation is cancelled
Hi again,
if you cancel R installation then installer by default proceeds further and fails to launch the app, even if you do have R already installed (in a different, compatible version). In the latter case the paths are not set correctly. There is no "cancel" nor "back" button in the step following the R installer, nor an automatic rollback/cancellation.
Best possibly would be to attempt to detect another, newer version of R (as a step torwards #24 ), and only if not found auto-rollback/cancel the installer. Independently, a "cancel" button in each step would make sense.
Best, Mik
I completely agree. We can probably tackle this and #24 in the same hotfix.
Did we address this in your most recent pull request?
No, the late "Cancel" plus rollback part is not there AFAIK. When working on #73, before I've discovered the Abort function, I actually had some hacks implemented that could be useful here (from the ".iss" file):
// Exit current process
procedure ExitProcess(exitCode:integer);
external '[email protected] stdcall';
// Get uninstallation command string
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
// Trigger explicit uninstallation
procedure Uninstall();
var
sUnInstallString: String;
iResultCode: Integer;
begin
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then
begin
sUnInstallString := RemoveQuotes(sUnInstallString);
Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode)
end;
end;
// Is R installed?
function RDetected(break: boolean): boolean;
var
v: Integer;
success: boolean;
begin
...
if (not success and break) then
begin
SuppressibleMsgBox(Format('Error: R >= %s not found',[RVersions[RVersions.Count - 1]]), mbError, MB_OK, MB_OK);
Uninstall();
ExitProcess(1);
end;
Result := success;
end;
// If R is not detected, it is needed
function RNeeded(): boolean;
begin
Result := not RDetected(false);
end;
// Save installation paths
procedure SaveInstallationPaths();
var
RPath, ChromePath, IEPath, FFPath, PandocPath: string;
begin
...
if Length(RRegKey) = 0 then
RDetected(true);
...
end
Feel free to use that if it helps. An explicit "Cancel" button could also use the "Uninstall(); ExitProcess(1)" sequence, +/- uninstalling R, Pandoc or Chrome if they were also installed.