Skip to content

Commit

Permalink
Fix inno setup paths cloudfuse (#294)
Browse files Browse the repository at this point in the history
* Only change system path to add cloudfuse

* Fix issue
  • Loading branch information
jfantinhardesty authored Jul 23, 2024
1 parent 4bfeb78 commit ac85a8c
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions build/windows_installer_build.iss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ ArchitecturesInstallIn64BitMode=x64
SignTool=signtool /d $q{#MyAppName} v{#MyAppVersion}$q $f
SignedUninstaller=yes
VersionInfoVersion={#MyAppVersion}
; Tell Windows Explorer to reload the environment
ChangesEnvironment=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Expand Down Expand Up @@ -69,10 +71,31 @@ Source: "..\winfsp-2.0.23075.msi"; DestDir: "{app}"; Flags: ignoreversion
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; \
Check: NeedsAddPath('{app}')

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Code]
function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'Path', OrigPath)
then begin
Result := True;
exit;
end;
{ look for the path with leading and trailing semicolon }
{ Pos() returns 0 if not found }
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;
var
ResultCode: Integer;
Expand All @@ -92,12 +115,6 @@ begin
end;
end;
// Add cloudfuse to the path
if not Exec('cmd.exe', '/C SETX PATH "%PATH%;' + ExpandConstant('{app}') +'"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
MsgBox('Failed to update PATH. You may need to add the path manually to use Cloudfuse on the command line.', mbError, MB_OK);
end;
// Install the Cloudfuse Startup Tool
if not Exec(ExpandConstant('{app}\{#MyAppExeCLIName}'), 'service install', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
Expand Down

0 comments on commit ac85a8c

Please sign in to comment.