do not create a double semi colon when adding to path (#202583)

* do not create a double semi colon when adding to path

fixes #202268

* parens

* bad signature

* hm
pull/202306/head
João Moreno 2024-01-17 16:54:23 +01:00 committed by GitHub
parent 0692340700
commit 85d3cd0eef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 3 deletions

View File

@ -1296,7 +1296,7 @@ Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Drive\shell\{#RegValu
#define Uninstall32RootKey "HKLM32"
#endif
Root: {#EnvironmentRootKey}; Subkey: "{#EnvironmentKey}"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; Tasks: addtopath; Check: NeedsAddPath(ExpandConstant('{app}\bin'))
Root: {#EnvironmentRootKey}; Subkey: "{#EnvironmentKey}"; ValueType: expandsz; ValueName: "Path"; ValueData: "{code:AddToPath|{app}\bin}"; Tasks: addtopath; Check: NeedsAddToPath(ExpandConstant('{app}\bin'))
[Code]
function IsBackgroundUpdate(): Boolean;
@ -1553,7 +1553,7 @@ begin
until Length(Text)=0;
end;
function NeedsAddPath(Param: string): boolean;
function NeedsAddToPath(VSCode: string): boolean;
var
OrigPath: string;
begin
@ -1562,7 +1562,19 @@ begin
Result := True;
exit;
end;
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
Result := Pos(';' + VSCode + ';', ';' + OrigPath + ';') = 0;
end;
function AddToPath(VSCode: string): string;
var
OrigPath: string;
begin
RegQueryStringValue({#EnvironmentRootKey}, '{#EnvironmentKey}', 'Path', OrigPath)
if (Length(OrigPath) > 0) and (OrigPath[Length(OrigPath)] = ';') then
Result := OrigPath + VSCode
else
Result := OrigPath + ';' + VSCode
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);