Skip to content

Commit 85d3cd0

Browse files
authored
do not create a double semi colon when adding to path (microsoft#202583)
* do not create a double semi colon when adding to path fixes microsoft#202268 * parens * bad signature * hm
1 parent 0692340 commit 85d3cd0

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

build/win32/code.iss

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Drive\shell\{#RegValu
12961296
#define Uninstall32RootKey "HKLM32"
12971297
#endif
12981298

1299-
Root: {#EnvironmentRootKey}; Subkey: "{#EnvironmentKey}"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; Tasks: addtopath; Check: NeedsAddPath(ExpandConstant('{app}\bin'))
1299+
Root: {#EnvironmentRootKey}; Subkey: "{#EnvironmentKey}"; ValueType: expandsz; ValueName: "Path"; ValueData: "{code:AddToPath|{app}\bin}"; Tasks: addtopath; Check: NeedsAddToPath(ExpandConstant('{app}\bin'))
13001300

13011301
[Code]
13021302
function IsBackgroundUpdate(): Boolean;
@@ -1553,7 +1553,7 @@ begin
15531553
until Length(Text)=0;
15541554
end;
15551555
1556-
function NeedsAddPath(Param: string): boolean;
1556+
function NeedsAddToPath(VSCode: string): boolean;
15571557
var
15581558
OrigPath: string;
15591559
begin
@@ -1562,7 +1562,19 @@ begin
15621562
Result := True;
15631563
exit;
15641564
end;
1565-
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
1565+
Result := Pos(';' + VSCode + ';', ';' + OrigPath + ';') = 0;
1566+
end;
1567+
1568+
function AddToPath(VSCode: string): string;
1569+
var
1570+
OrigPath: string;
1571+
begin
1572+
RegQueryStringValue({#EnvironmentRootKey}, '{#EnvironmentKey}', 'Path', OrigPath)
1573+
1574+
if (Length(OrigPath) > 0) and (OrigPath[Length(OrigPath)] = ';') then
1575+
Result := OrigPath + VSCode
1576+
else
1577+
Result := OrigPath + ';' + VSCode
15661578
end;
15671579
15681580
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);

0 commit comments

Comments
 (0)