mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:14:25 +02:00
pastojs: nodejs file functions
git-svn-id: trunk@40106 -
This commit is contained in:
parent
ba64c44486
commit
c64ca00dfe
@ -236,11 +236,7 @@ function TryCreateRelativePath(const Filename, BaseDirectory: String;
|
|||||||
var
|
var
|
||||||
UpDirCount: Integer;
|
UpDirCount: Integer;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
{$IFDEF Pas2js}
|
|
||||||
s: string;
|
s: string;
|
||||||
{$ELSE}
|
|
||||||
ResultPos, FileNameRestLen: Integer;
|
|
||||||
{$ENDIF}
|
|
||||||
SharedDirs: Integer;
|
SharedDirs: Integer;
|
||||||
FileP, BaseP, FileEndP, BaseEndP, FileL, BaseL: integer;
|
FileP, BaseP, FileEndP, BaseEndP, FileL, BaseL: integer;
|
||||||
begin
|
begin
|
||||||
@ -313,7 +309,6 @@ begin
|
|||||||
exit(true);
|
exit(true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF Pas2js}
|
|
||||||
s:='';
|
s:='';
|
||||||
for i:=1 to UpDirCount do
|
for i:=1 to UpDirCount do
|
||||||
s+='..'+PathDelim;
|
s+='..'+PathDelim;
|
||||||
@ -322,19 +317,6 @@ begin
|
|||||||
else
|
else
|
||||||
s+=copy(Filename,FileP);
|
s+=copy(Filename,FileP);
|
||||||
RelPath:=s;
|
RelPath:=s;
|
||||||
{$ELSE}
|
|
||||||
FileNameRestLen:=length(Filename)-(FileP-1);
|
|
||||||
SetLength(RelPath,3*UpDirCount+FileNameRestLen);
|
|
||||||
ResultPos:=1;
|
|
||||||
for i:=1 to UpDirCount do begin
|
|
||||||
RelPath[ResultPos]:='.';
|
|
||||||
RelPath[ResultPos+1]:='.';
|
|
||||||
RelPath[ResultPos+2]:=PathDelim;
|
|
||||||
inc(ResultPos,3);
|
|
||||||
end;
|
|
||||||
if FileNameRestLen>0 then
|
|
||||||
Move(FileP^,RelPath[ResultPos],FileNameRestLen);
|
|
||||||
{$ENDIF}
|
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user