Skip to content

Commit

Permalink
Update EDMC_Installer_Config_template.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Rixxan committed Jun 11, 2024
1 parent 5d43388 commit 75f7859
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions resources/EDMC_Installer_Config_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,50 +54,6 @@ Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: de
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

;Check if a WiX-based installation exists. If so, kill it with fire.
[Code]
function EndsWith(SubText, Text: AnsiString): Boolean;
var
EndStr: string;
begin
Log('Starting');
EndStr := Copy(Text, Length(Text) - Length(SubText) + 1, Length(SubText));
Log(EndStr);
{ Use SameStr, if you need a case-sensitive comparison }
Result := SameText(SubText, EndStr);
end;

// EDMC didn't keep a consistant GUID during previous history. Due to that, we have to do this tomfoolery.
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
Uninstall: String;
OldWiX: Boolean;
S: AnsiString;
PowerShellOutputFile: String;
begin
if (CurStep = ssInstall) then
begin
PowerShellOutputFile := ExpandConstant('{tmp}\PowershellOutput.txt');
// Construct the PowerShell command and capture output to a file
Exec('powershell.exe', '-NoProfile -ExecutionPolicy Bypass -Command "Get-WmiObject -Class Win32_Product | where Name -eq ''Elite Dangerous Market Connector'' | select-object -expandproperty IdentifyingNumber" | Out-File -Encoding ASCII "' + PowerShellOutputFile + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
begin
if LoadStringFromFile(PowerShellOutputFile, S) then
S:= Trim(S);
Log(S);
begin
OldWiX:=EndsWith('}', S);
if (OldWiX = True) then
begin
MsgBox('Warning: an old version of EDMC is installed! Please close EDMC while we remove the old version!', mbInformation, MB_OK);
Uninstall := '/x ' + S;
Exec('MsiExec.exe', Uninstall, '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;
end;
end;
end;

[Registry]
; Create the main registry key under HKCR
Root: HKCR; Subkey: "edmc"; Flags: uninsdeletekey
Expand Down

0 comments on commit 75f7859

Please sign in to comment.