Skip to content

Commit 68dd3f7

Browse files
committed
feat(windows installer): allow not adding application to path env var
Let the users decide if they want to add the application to the environment path Inspired by https://github.com/iterative/dvc-exe/blob/main/setup.iss file
1 parent e50d622 commit 68dd3f7

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

windows/ardupilot_methodic_configurator.iss

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ AppPublisherURL={#MyAppURL}
2222
AppSupportURL={#MyAppURL}
2323
AppUpdatesURL={#MyAppURL}
2424
DefaultDirName={commonpf}\{#MyAppName}
25+
; DefaultDirName={code:GetDefaultDirName}
2526
DefaultGroupName={#MyAppName}
2627
LicenseFile=..\LICENSE.md
2728
OutputBaseFilename=ardupilot_methodic_configurator_setup_{#MyAppVersion}
@@ -76,7 +77,8 @@ Name: "ja"; MessagesFile: "compiler:Languages\Japanese.isl"
7677

7778
[Tasks]
7879
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
79-
Name: "modifypath"; Description: "&Add application directory to your system path"; Flags: unchecked
80+
Name: "modifypath"; Description: "&Add application directory to environmental path for current user. For command line use"; Flags: unchecked checkablealone
81+
Name: "modifypath\system"; Description: Add application directory to environmental path for all users. For command line use; Flags: unchecked
8082

8183
[Files]
8284
Source: "..\ardupilot_methodic_configurator\dist\ardupilot_methodic_configurator\ardupilot_methodic_configurator.exe"; DestDir: "{app}"; Flags: ignoreversion
@@ -109,8 +111,33 @@ Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChang
109111

110112
[Code]
111113
const
112-
ModPathName = 'modifypath';
113-
ModPathType = 'system';
114-
ModPathPath = '{app}';
114+
ModPathName = 'modifypath';
115+
ModPathPath = '{app}';
116+
117+
var
118+
ModPathType: String;
119+
120+
function GetDefaultDirName(Dummy: string): string;
121+
begin
122+
if IsAdminLoggedOn then begin
123+
Result := ExpandConstant('{pf}\{#MyAppName}');
124+
end else begin
125+
Result := ExpandConstant('{userpf}\{#MyAppName}');
126+
end;
127+
end;
115128
116129
#include "modpath.iss"
130+
131+
procedure CurStepChanged(CurStep: TSetupStep);
132+
begin
133+
if CurStep = ssPostInstall then begin
134+
if IsTaskSelected(ModPathName + '\system') then begin
135+
ModPathType := 'system';
136+
end else begin
137+
ModPathType := 'user';
138+
end;
139+
140+
if IsTaskSelected(ModPathName) then
141+
ModPath();
142+
end;
143+
end;

0 commit comments

Comments
 (0)