Skip to content

Commit c60a7e3

Browse files
committed
no need to look for Workbench install location
1 parent f5a81ec commit c60a7e3

File tree

1 file changed

+8
-54
lines changed

1 file changed

+8
-54
lines changed

package/inno_package.iss

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,12 @@ Name: "{autodesktop}\FORCE Examples"; Filename: "{app}\examples"; Tasks: desktop
5858

5959
[Registry]
6060
; File association for .heron files
61-
Root: HKCU; Subkey: "Software\Classes\.heron"; ValueType: string; ValueName: ""; ValueData: "FORCE.heron"; Flags: uninsdeletevalue
62-
Root: HKCU; Subkey: "Software\Classes\FORCE.heron"; ValueType: string; ValueName: ""; ValueData: "HERON File"; Flags: uninsdeletekey
63-
Root: HKCU; Subkey: "Software\Classes\FORCE.heron\DefaultIcon"; ValueType: string; ValueData: "{app}\heron.exe,0"
61+
Root: HKCU; Subkey: "Software\Classes\.heron"; ValueType: string; ValueName: ""; ValueData: "FORCE.heron"; Flags: uninsdeletevalue; Check: WizardIsTaskSelected('workbenchinstall')
62+
Root: HKCU; Subkey: "Software\Classes\FORCE.heron"; ValueType: string; ValueName: ""; ValueData: "HERON File"; Flags: uninsdeletekey; Check: WizardIsTaskSelected('workbenchinstall')
63+
Root: HKCU; Subkey: "Software\Classes\FORCE.heron\DefaultIcon"; ValueType: string; ValueData: "{app}\heron.exe,0"; Check: WizardIsTaskSelected('workbenchinstall')
6464
; The open command will be set dynamically in the [Code] section
6565

66-
;[Run]
67-
;Filename: "{app}\Workbench-5.4.1.exe"; Description: "Install NEAMS Workbench-5.4.1"; Flags: nowait postinstall skipifsilent
68-
6966
[Code]
70-
var
71-
WorkbenchPath: string;
72-
7367
procedure InitializeProgressBar();
7468
begin
7569
WizardForm.ProgressGauge.Style := npbstMarquee;
@@ -84,50 +78,17 @@ begin
8478
WizardForm.StatusLabel.Caption := 'Installing NEAMS Workbench-5.4.1...';
8579
8680
try
87-
Exec(ExpandConstant('{app}\Workbench-5.4.1.exe'), ExpandConstant('/S /D={autopf}\Workbench-5.4.1\'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
81+
Exec(ExpandConstant('{app}\Workbench-5.4.1.exe'), ExpandConstant('/S /D={autopf}\Workbench-5.4.1\'), '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
8882
finally
8983
WizardForm.ProgressGauge.Visible := False;
9084
WizardForm.ProgressGauge.Style := npbstNormal;
9185
WizardForm.StatusLabel.Caption := '';
9286
end;
9387
end;
9488
95-
function FindWorkbenchInstallPath(): string;
96-
var
97-
Paths: array of string;
98-
Path: string;
99-
I: Integer;
100-
begin
101-
Result := '';
102-
// Workbench should be installed in {autopf} alongside the FORCE installation, but we'll also check
103-
// other common locations for the Workbench executable just in case it hasn't been found there.
104-
Paths := [
105-
ExpandConstant('{autopf}'),
106-
ExpandConstant('{app}'),
107-
ExpandConstant('{%USERPROFILE}'),
108-
ExpandConstant('{userpf}'),
109-
ExpandConstant('{userprograms}'),
110-
ExpandConstant('{commonpf}'),
111-
ExpandConstant('{commonpf64}'),
112-
ExpandConstant('{commonpf32}'),
113-
ExpandConstant('{commonprograms}'),
114-
ExpandConstant('{sd}')
115-
];
116-
for I := 0 to GetArrayLength(Paths) - 1 do
117-
begin
118-
Path := Paths[I];
119-
// MsgBox('Checking for Workbench at path ' + Path + '\Workbench-5.4.1\bin\Workbench.exe', mbInformation, MB_OK);
120-
if FileExists(Path + '\Workbench-5.4.1\bin\Workbench.exe') then
121-
begin
122-
Result := Path + '\Workbench-5.4.1\';
123-
// MsgBox('Found workbench at path ' + Result + '!', mbInformation, MB_OK);
124-
break;
125-
end;
126-
end;
127-
end;
128-
12989
procedure CurStepChanged(CurStep: TSetupStep);
13090
var
91+
WorkbenchPath: string;
13192
DefaultAppsFilePath: string;
13293
DefaultAppsContent: string;
13394
ResultCode: Integer;
@@ -139,7 +100,7 @@ begin
139100
RunWorkbenchInstaller();
140101
141102
// Find the path to the Workbench executable
142-
WorkbenchPath := FindWorkbenchInstallPath();
103+
WorkbenchPath := ExpandConstant('{autopf}\Workbench-5.4.1\');
143104
144105
// Associate .heron files with the Workbench executable
145106
RegWriteStringValue(HKEY_CURRENT_USER, 'Software\Classes\FORCE.heron\shell\open\command', '', '"' + WorkbenchPath + 'bin\Workbench.exe' + '" "%1"');
@@ -168,16 +129,9 @@ begin
168129
end;
169130
170131
// Save the path to the Workbench executable in a file at {app}/.workbench.
171-
if not SaveStringToFile(ExpandConstant('{app}') + '\.workbench', 'WORKBENCHDIR=' + WorkbenchPath, False) then
172-
begin
173-
MsgBox('Failed to save the path to the Workbench executable. Attempted to write to ' + ExpandConstant('{app}') + '\.workbench', mbError, MB_OK);
174-
end;
175-
end
176-
else
177-
begin
178-
if CurStep = ssPostInstall then
132+
if not SaveStringToFile(ExpandConstant('{app}\.workbench'), 'WORKBENCHDIR=' + WorkbenchPath, False) then
179133
begin
180-
MsgBox('Workbench not installed. Not creating Workbench defaults. WorkbenchPath = ' + WorkbenchPath, mbInformation, MB_OK);
134+
MsgBox('Failed to save the path to the Workbench executable. Attempted to write to ' + ExpandConstant('{app}\.workbench'), mbError, MB_OK);
181135
end;
182136
end;
183137
end;

0 commit comments

Comments
 (0)