mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 15:10:16 +02:00
lazutils: TrimFilename: optimized
git-svn-id: trunk@43403 -
This commit is contained in:
parent
73a2ef1ce7
commit
b4a999be14
@ -559,15 +559,17 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := AFileName;
|
Result := AFileName;
|
||||||
Len := Length(AFileName);
|
Len := Length(AFileName);
|
||||||
if (Len > 0) and not FilenameIsTrimmed(Result) then
|
if (Len = 0) or FilenameIsTrimmed(Result) then exit;
|
||||||
|
if AFilename[1] = #32 then
|
||||||
begin
|
begin
|
||||||
Start := 1;
|
Start := 1;
|
||||||
while (Len > 0) and (AFileName[Len] = #32) do Dec(Len);
|
|
||||||
while (Start <= Len) and (AFilename[Start] = #32) do Inc(Start);
|
while (Start <= Len) and (AFilename[Start] = #32) do Inc(Start);
|
||||||
if Start > 1 then System.Delete(Result,1,Start-1);
|
System.Delete(Result,1,Start-1);
|
||||||
SetLength(Result, Len - (Start - 1));
|
Len := Length(AFileName);
|
||||||
Result := ResolveDots(Result);
|
|
||||||
end;
|
end;
|
||||||
|
while (Len > 0) and (AFileName[Len] = #32) do Dec(Len);
|
||||||
|
SetLength(Result, Len);
|
||||||
|
Result := ResolveDots(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ForcePathDelims(var FileName: string);
|
procedure ForcePathDelims(var FileName: string);
|
||||||
|
Loading…
Reference in New Issue
Block a user