Create Windows installer #53
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
This commit is contained in:
130
repertory.iss.in
130
repertory.iss.in
@@ -12,38 +12,137 @@
|
|||||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||||
AppId={{BD165823-1DEF-4D23-87DC-3D7A9BB73A00}
|
AppId={{BD165823-1DEF-4D23-87DC-3D7A9BB73A00}
|
||||||
AppName={#MyAppName}
|
AppName={#MyAppName}
|
||||||
AppVersion={#MyAppVersion}
|
|
||||||
AppPublisher={#MyAppPublisher}
|
AppPublisher={#MyAppPublisher}
|
||||||
AppPublisherURL={#MyAppURL}
|
AppPublisherURL={#MyAppURL}
|
||||||
AppSupportURL={#MyAppURL}
|
AppSupportURL={#MyAppURL}
|
||||||
AppUpdatesURL={#MyAppURL}
|
AppUpdatesURL={#MyAppURL}
|
||||||
DefaultDirName={autopf}\{#MyAppName}
|
AppVersion={#MyAppVersion}
|
||||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
|
||||||
ArchitecturesAllowed=x64compatible
|
ArchitecturesAllowed=x64compatible
|
||||||
ArchitecturesInstallIn64BitMode=x64compatible
|
ArchitecturesInstallIn64BitMode=x64compatible
|
||||||
|
DefaultDirName={autopf}\{#MyAppName}
|
||||||
DefaultGroupName={#MyAppName}
|
DefaultGroupName={#MyAppName}
|
||||||
DisableProgramGroupPage=yes
|
DisableProgramGroupPage=yes
|
||||||
LicenseFile=repertory\LICENSE.md
|
LicenseFile=repertory\LICENSE.md
|
||||||
OutputBaseFilename=repertory_{#MyAppVersion}_windows_@PROJECT_MARCH@_setup
|
OutputBaseFilename=repertory_{#MyAppVersion}_windows_@PROJECT_MARCH@_setup
|
||||||
|
PrivilegesRequired=admin
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
|
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||||
WizardStyle=modern
|
WizardStyle=modern
|
||||||
|
|
||||||
[code]
|
[code]
|
||||||
function CheckAddPath(Param: string): boolean;
|
procedure RefreshEnvironment();
|
||||||
var
|
var
|
||||||
CurPath: string;
|
R: Cardinal;
|
||||||
PathPos: Integer;
|
|
||||||
begin
|
begin
|
||||||
if RegQueryStringValue(HKEY_LOCAL_MACHINE,
|
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
|
||||||
|
LPARAM(PChar('Environment')), SMTO_ABORTIFHUNG, 5000, R);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function NormalizeSemicolons(S: string): string;
|
||||||
|
begin
|
||||||
|
while Pos(';;', S) > 0 do
|
||||||
|
StringChange(S, ';;', ';');
|
||||||
|
Result := S;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CheckAddPath(NewPath: string): Boolean;
|
||||||
|
var
|
||||||
|
OldPath: string;
|
||||||
|
begin
|
||||||
|
if not RegQueryStringValue(HKLM,
|
||||||
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
|
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
|
||||||
'PATH', CurPath)
|
'Path', OldPath)
|
||||||
then begin
|
then
|
||||||
PathPos := Pos(';' + Param + ';', ';' + CurPath + ';');
|
OldPath := '';
|
||||||
Result := PathPos = 0;
|
|
||||||
exit;
|
Result := Pos(LowerCase(NewPath), LowerCase(OldPath)) = 0;
|
||||||
|
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 CurStepChanged(CurStep: TSetupStep);
|
||||||
|
begin
|
||||||
|
if CurStep = ssPostInstall then
|
||||||
|
begin
|
||||||
|
AddAppToPath();
|
||||||
|
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;
|
end;
|
||||||
|
|
||||||
Result := True;
|
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 DeinitializeUninstall();
|
||||||
|
begin
|
||||||
|
RemoveAppFromPath();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
@@ -64,8 +163,3 @@ Name: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Paramet
|
|||||||
[Run]
|
[Run]
|
||||||
Filename: "msiexec.exe"; WorkingDir: "{app}"; Parameters: "/a winfsp-@WINFSP_VERSION@.msi /norestart"; \
|
Filename: "msiexec.exe"; WorkingDir: "{app}"; Parameters: "/a winfsp-@WINFSP_VERSION@.msi /norestart"; \
|
||||||
Flags: 64bit waituntilterminated; Components: winfsp
|
Flags: 64bit waituntilterminated; Components: winfsp
|
||||||
|
|
||||||
[Registry]
|
|
||||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
|
|
||||||
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app};"; \
|
|
||||||
Check: CheckAddPath(ExpandConstant('{app}'))
|
|
||||||
|
Reference in New Issue
Block a user