Browse Source

* skip empty path components in concatpaths, related to #40682

(cherry picked from commit 2ec99cc82e1c1f9d602d287d515486df0d51fef3)
marcoonthegit 1 year ago
parent
commit
9d39bcbdec
1 changed files with 6 additions and 4 deletions
  1. 6 4
      rtl/objpas/sysutils/fina.inc

+ 6 - 4
rtl/objpas/sysutils/fina.inc

@@ -510,12 +510,14 @@ function ConcatPaths(const Paths: array of PathStr): PathStr;
 var
 var
   I: Integer;
   I: Integer;
 begin
 begin
+  Result := '';
   if Length(Paths) > 0 then
   if Length(Paths) > 0 then
   begin
   begin
-    Result := Paths[0];
+    if Paths[0]<>'' then
+      Result := Paths[0];
     for I := 1 to Length(Paths) - 1 do
     for I := 1 to Length(Paths) - 1 do
-      Result := IncludeTrailingPathDelimiter(Result) + ExcludeLeadingPathDelimiter(Paths[I]);
-  end else
-    Result := '';
+      if Paths[i]<>'' then
+        Result := IncludeTrailingPathDelimiter(Result) + ExcludeLeadingPathDelimiter(Paths[I]);
+  end
 end;
 end;