mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 12:59:19 +02:00
LazUtils: in ResolveDots() convert '/'to '\' on Windows.
This allows for better removing of double path delimiters. (WinApi accepts '//' and treats it as '\' , bot not so for '/\') git-svn-id: trunk@42599 -
This commit is contained in:
parent
063ff08625
commit
f05ba71d75
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
function ResolveDots(const AFilename: string): String;
|
function ResolveDots(const AFilename: string): String;
|
||||||
//trim double path delims and expand special dirs like .. and .
|
//trim double path delims and expand special dirs like .. and .
|
||||||
|
//on Windows change also '/' to '\'
|
||||||
var SrcPos, DestPos, l, DirStart: integer;
|
var SrcPos, DestPos, l, DirStart: integer;
|
||||||
c: char;
|
c: char;
|
||||||
MacroPos: LongInt;
|
MacroPos: LongInt;
|
||||||
@ -17,6 +18,10 @@ begin
|
|||||||
// trim double path delimiters and special dirs . and ..
|
// trim double path delimiters and special dirs . and ..
|
||||||
while (SrcPos<=l) do begin
|
while (SrcPos<=l) do begin
|
||||||
c:=AFilename[SrcPos];
|
c:=AFilename[SrcPos];
|
||||||
|
{$ifdef windows}
|
||||||
|
//change / to \. The WinApi accepts both, but it leads to strange effects in other places
|
||||||
|
if (c='/') then c := PathDelim;
|
||||||
|
{$endif}
|
||||||
// check for double path delims
|
// check for double path delims
|
||||||
if (c=PathDelim) then begin
|
if (c=PathDelim) then begin
|
||||||
inc(SrcPos);
|
inc(SrcPos);
|
||||||
@ -120,6 +125,10 @@ begin
|
|||||||
inc(SrcPos);
|
inc(SrcPos);
|
||||||
if (SrcPos>l) then break;
|
if (SrcPos>l) then break;
|
||||||
c:=AFilename[SrcPos];
|
c:=AFilename[SrcPos];
|
||||||
|
{$ifdef windows}
|
||||||
|
//change / to \. The WinApi accepts both, but it leads to strange effects in other places
|
||||||
|
if (c='/') then c := PathDelim;
|
||||||
|
{$endif}
|
||||||
if c=PathDelim then break;
|
if c=PathDelim then break;
|
||||||
until false;
|
until false;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user