Skip to content

Commit 2e5908d

Browse files
committed
Исправлены ошибки в скрипте инсталлятора
1 parent 4deb4b9 commit 2e5908d

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

install/ovm.iss

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Compression=lzma
2828
SolidCompression=yes
2929
; Per-user installation (no admin rights required)
3030
PrivilegesRequired=lowest
31-
PrivilegesRequiredOverridesAllowed=dialog
31+
PrivilegesRequiredOverridesAllowed=commandline
3232
; Notify Windows about environment changes
3333
ChangesEnvironment=yes
3434
ArchitecturesInstallIn64BitMode=x64
@@ -77,7 +77,7 @@ begin
7777
begin
7878
if RegQueryStringValue(HKEY_CURRENT_USER, EnvironmentKey, 'Path', OrigPath) then
7979
begin
80-
// Remove trailing backslash if present
80+
// Add semicolon separator if PATH doesn't already end with one
8181
if (Length(OrigPath) > 0) and (OrigPath[Length(OrigPath)] = ';') then
8282
NewPath := OrigPath + AppPath
8383
else
@@ -108,6 +108,7 @@ var
108108
NewPath: string;
109109
AppPath: string;
110110
PathList: TStringList;
111+
PathItem: string;
111112
i: Integer;
112113
begin
113114
if CurUninstallStep = usPostUninstall then
@@ -121,13 +122,27 @@ begin
121122
PathList.StrictDelimiter := True;
122123
PathList.DelimitedText := OrigPath;
123124
124-
// Remove our path from the list
125+
// Remove our path from the list (both with and without trailing backslash)
126+
// Also remove empty entries to avoid ";;" in PATH
125127
for i := PathList.Count - 1 downto 0 do
126128
begin
127-
if Uppercase(PathList[i]) = Uppercase(AppPath) then
129+
PathItem := PathList[i];
130+
131+
// Remove empty entries
132+
if Trim(PathItem) = '' then
128133
begin
129134
PathList.Delete(i);
130-
Log('Removed from PATH: ' + AppPath);
135+
Continue;
136+
end;
137+
138+
// Normalize by removing trailing backslash for comparison
139+
if PathItem[Length(PathItem)] = '\' then
140+
PathItem := Copy(PathItem, 1, Length(PathItem) - 1);
141+
142+
if Uppercase(PathItem) = Uppercase(AppPath) then
143+
begin
144+
Log('Removed from PATH: ' + PathList[i]);
145+
PathList.Delete(i);
131146
end;
132147
end;
133148

0 commit comments

Comments
 (0)