diff --git a/rtl/objpas/sysutils/finah.inc b/rtl/objpas/sysutils/finah.inc index 64cec5c971..1504c5b325 100644 --- a/rtl/objpas/sysutils/finah.inc +++ b/rtl/objpas/sysutils/finah.inc @@ -29,7 +29,7 @@ function ExtractShortPathName(Const FileName : PathStr) : PathStr; function ExpandFileName (Const FileName : PathStr): PathStr; function ExpandFileNameCase (const FileName: PathStr; out MatchFound: TFilenameCaseMatch): PathStr; function ExpandUNCFileName (Const FileName : PathStr): PathStr; -function ExtractRelativePath (Const BaseName,DestNAme : PathStr): PathStr; +function ExtractRelativePath (Const BaseName,DestName : PathStr): PathStr; function IncludeTrailingPathDelimiter(Const Path : PathStr) : PathStr; function IncludeTrailingBackslash(Const Path : PathStr) : PathStr; function ExcludeTrailingBackslash(Const Path: PathStr): PathStr; diff --git a/rtl/objpas/sysutils/syshelp.inc b/rtl/objpas/sysutils/syshelp.inc index e30e473f1d..f9676d2c88 100644 --- a/rtl/objpas/sysutils/syshelp.inc +++ b/rtl/objpas/sysutils/syshelp.inc @@ -1225,9 +1225,12 @@ begin begin T:=SubString(LastSep); // Writeln('Examining >',T,'< at pos,',LastSep,' till pos ',Sep); - MaybeGrow(Len); - Result[Len]:=T; - Inc(Len); + If (T<>'') or (not (TStringSplitOptions.ExcludeEmpty=Options)) then + begin + MaybeGrow(Len); + Result[Len]:=T; + Inc(Len); + end; end; SetLength(Result,Len); end; @@ -1308,9 +1311,12 @@ begin begin T:=SubString(LastSep); // Writeln('Examining >',T,'< at pos,',LastSep,' till pos ',Sep); - MaybeGrow(Len); - Result[Len]:=T; - Inc(Len); + If (T<>'') or (not (TStringSplitOptions.ExcludeEmpty=Options)) then + begin + MaybeGrow(Len); + Result[Len]:=T; + Inc(Len); + end; end; SetLength(Result,Len); end;