; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "repertory" #define MyAppVersion "@PROJECT_MAJOR_VERSION@.@PROJECT_MINOR_VERSION@.@PROJECT_REVISION_VERSION@-@PROJECT_RELEASE_ITER@_@PROJECT_GIT_REV@" #define MyAppPublisher "BlockStorage" #define MyAppURL "https://git.fifthgrid.com/BlockStorage/repertory" #define MyAppExeName "repertory.exe" [Setup] ; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{BD165823-1DEF-4D23-87DC-3D7A9BB73A00} AppName={#MyAppName} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} AppVersion={#MyAppVersion} ArchitecturesAllowed=x64compatible ArchitecturesInstallIn64BitMode=x64compatible DefaultDirName={autopf}\{#MyAppName} DefaultGroupName={#MyAppName} DisableProgramGroupPage=yes LicenseFile=repertory\LICENSE.md OutputBaseFilename=repertory_{#MyAppVersion}_windows_@PROJECT_MARCH@_setup PrivilegesRequired=admin SolidCompression=yes UninstallDisplayIcon={app}\{#MyAppExeName} WizardStyle=modern [code] const SMTO_ABORTIFHUNG = $0002; WM_SETTINGCHANGE = $001A; type LPARAM = LongWord; LRESULT = LongWord; WPARAM = LongWord; function SendMessageTimeout(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM; fuFlags: UINT; uTimeout: UINT; out lpdwResult: DWORD): LRESULT; external 'SendMessageTimeoutW@user32.dll stdcall'; procedure RefreshEnvironment(); var R: DWORD; begin SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'Environment', SMTO_ABORTIFHUNG, 5000, R); end; function NormalizeSemicolons(S: string): string; begin while Pos(';;', S) > 0 do StringChange(S, ';;', ';'); Result := S; end; procedure AddAppToPath(); var OldPath, NewPath, FinalPath: string; begin if not RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', OldPath) then OldPath := ''; NewPath := ExpandConstant('{app}'); if Pos(LowerCase(NewPath), LowerCase(OldPath)) = 0 then begin if (OldPath <> '') and (Copy(OldPath, Length(OldPath), 1) <> ';') then OldPath := OldPath + ';'; FinalPath := NormalizeSemicolons(OldPath + NewPath + ';'); RegWriteExpandStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', FinalPath); RefreshEnvironment(); end; end; procedure RemoveAppFromPath(); var OldPath, NewPath, Token, Remainder, FinalPath: string; p: Integer; begin if not RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', OldPath) then Exit; NewPath := ExpandConstant('{app}'); Remainder := OldPath; FinalPath := ''; while Length(Remainder) > 0 do begin p := Pos(';', Remainder); if p = 0 then begin Token := Remainder; Remainder := ''; end else begin Token := Copy(Remainder, 1, p - 1); Delete(Remainder, 1, p); end; Token := Trim(Token); if (Token <> '') and (CompareText(Token, NewPath) <> 0) then begin if (FinalPath <> '') and (FinalPath[Length(FinalPath)] <> ';') then FinalPath := FinalPath + ';'; FinalPath := FinalPath + Token; end; end; while Pos(';;', FinalPath) > 0 do StringChange(FinalPath, ';;', ';'); if (FinalPath <> '') and (FinalPath[Length(FinalPath)] = ';') then Delete(FinalPath, Length(FinalPath), 1); RegWriteExpandStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', FinalPath); RefreshEnvironment(); end; procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssPostInstall then begin AddAppToPath(); end; end; procedure DeinitializeUninstall(); begin RemoveAppFromPath(); end; [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" [Components] Name: "main"; Description: "Repertory Core"; Types: full compact custom; Flags: fixed Name: "winfsp"; Description: "WinFSP v@WINFSP_VERSION@"; Types: full custom [Files] Source: "repertory\*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: main Source: "3rd_party\winfsp-@WINFSP_VERSION@.msi"; DestDir: "{app}"; Flags: ignoreversion; Components: winfsp [Icons] Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "-ui --hidden" Name: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "-ui --launch_only --hidden" [Run] Filename: "msiexec.exe"; WorkingDir: "{app}"; Parameters: "/a winfsp-@WINFSP_VERSION@.msi /norestart"; \ Flags: 64bit waituntilterminated; Components: winfsp