Skip to content

Commit e1e35dd

Browse files
committed
Исправлено замечание copilot
1 parent 155d2b0 commit e1e35dd

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

install/ovm.iss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ var
5151
ParamExpanded: string;
5252
begin
5353
ParamExpanded := ExpandConstant(Param);
54+
// Normalize: remove trailing backslash
55+
if (Length(ParamExpanded) > 0) and (ParamExpanded[Length(ParamExpanded)] = '\') then
56+
ParamExpanded := Copy(ParamExpanded, 1, Length(ParamExpanded) - 1);
57+
5458
if not RegQueryStringValue(HKEY_CURRENT_USER, EnvironmentKey, 'Path', OrigPath) then
5559
begin
5660
Result := True;
@@ -114,6 +118,10 @@ begin
114118
if CurUninstallStep = usPostUninstall then
115119
begin
116120
AppPath := ExpandConstant('{app}');
121+
// Normalize: remove trailing backslash
122+
if (Length(AppPath) > 0) and (AppPath[Length(AppPath)] = '\') then
123+
AppPath := Copy(AppPath, 1, Length(AppPath) - 1);
124+
117125
if RegQueryStringValue(HKEY_CURRENT_USER, EnvironmentKey, 'Path', OrigPath) then
118126
begin
119127
PathList := TStringList.Create;
@@ -136,7 +144,7 @@ begin
136144
end;
137145
138146
// Normalize by removing trailing backslash for comparison
139-
if PathItem[Length(PathItem)] = '\' then
147+
if (Length(PathItem) > 0) and (PathItem[Length(PathItem)] = '\') then
140148
PathItem := Copy(PathItem, 1, Length(PathItem) - 1);
141149
142150
if Uppercase(PathItem) = Uppercase(AppPath) then

0 commit comments

Comments
 (0)