mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
parent
64196fe6ad
commit
3d10587041
|
@ -17,22 +17,28 @@ Source: "bin\oh-my-posh.exe"; DestDir: "{app}\bin"
|
||||||
Source: "bin\themes\*"; DestDir: "{app}\themes"
|
Source: "bin\themes\*"; DestDir: "{app}\themes"
|
||||||
|
|
||||||
[Registry]
|
[Registry]
|
||||||
Root: "HKCU"; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; Check: NeedsAddPathHKCU(ExpandConstant('{app}\bin'))
|
Root: "HKA"; Subkey: "{code:GetEnvironmentKey}"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; Check: NeedsAddPathHKA(ExpandConstant('{app}\bin'))
|
||||||
Root: "HKCU"; Subkey: "Environment"; ValueType: string; ValueName: "POSH_THEMES_PATH"; ValueData: {app}\themes; Flags: preservestringtype
|
Root: "HKA"; Subkey: "{code:GetEnvironmentKey}"; ValueType: string; ValueName: "POSH_THEMES_PATH"; ValueData: {app}\themes; Flags: preservestringtype
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
function NeedsAddPathHKCU(Param: string): boolean;
|
function GetEnvironmentKey(Param: string): string;
|
||||||
var
|
|
||||||
OrigPath: string;
|
|
||||||
begin
|
begin
|
||||||
if not RegQueryStringValue(HKEY_CURRENT_USER,
|
if IsAdminInstallMode then
|
||||||
'Environment',
|
Result := 'System\CurrentControlSet\Control\Session Manager\Environment'
|
||||||
'Path', OrigPath)
|
else
|
||||||
then begin
|
Result := 'Environment';
|
||||||
Result := True;
|
|
||||||
exit;
|
|
||||||
end;
|
end;
|
||||||
// look for the path with leading and trailing semicolon
|
|
||||||
// Pos() returns 0 if not found
|
function NeedsAddPathHKA(Param: string): boolean;
|
||||||
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
|
var
|
||||||
|
OrigPath: string;
|
||||||
|
begin
|
||||||
|
if not RegQueryStringValue(HKA, GetEnvironmentKey(''), '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;
|
end;
|
||||||
|
|
Loading…
Reference in a new issue