|
@@ -16,38 +16,58 @@
|
|
{$I textrec.inc}
|
|
{$I textrec.inc}
|
|
{$I filerec.inc}
|
|
{$I filerec.inc}
|
|
|
|
|
|
-Function FpLink (existing : AnsiString; newone : AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpLink (const existing : RawByteString; const newone : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemExistingFileName, SystemNewOneFileName: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpLink:=FpLink(pchar(existing),pchar(newone));
|
|
|
|
|
|
+ SystemExistingFileName:=ToSingleByteFileSystemEncodedFileName(existing);
|
|
|
|
+ SystemNewOneFileName:=ToSingleByteFileSystemEncodedFileName(newone);
|
|
|
|
+ FpLink:=FpLink(pchar(SystemExistingFileName),pchar(SystemNewOneFileName));
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpMkfifo (path : AnsiString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpMkfifo (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpMkfifo:=FpMkfifo(pchar(path),mode);
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpMkfifo:=FpMkfifo(pchar(SystemPath),mode);
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpChmod (path : AnsiString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpChmod (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpChmod:=FpChmod(pchar(path),mode);
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpChmod:=FpChmod(pchar(SystemPath),mode);
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpChown (path : AnsiString; owner : TUid; group : TGid): cInt;{$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpChown (const path : RawByteString; owner : TUid; group : TGid): cInt;{$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpChown:=FpChown(pchar(path),owner,group);
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpChown:=FpChown(pchar(SystemPath),owner,group);
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpUtime (path : AnsiString; times : putimbuf): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpUtime (const path : RawByteString; times : putimbuf): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpUtime:=FpUtime(pchar(path),times);
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpUtime:=FpUtime(pchar(SystemPath),times);
|
|
End;
|
|
End;
|
|
|
|
|
|
{
|
|
{
|
|
-Function FpGetcwd (path:AnsiString; siz:TSize):AnsiString; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpGetcwd (const path:RawByteString; siz:TSize):RawByteString; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpGetcwd:=ansistring(pchar(FpGetcwd(pchar(path),siz)));
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpGetcwd:=RawByteString(pchar(FpGetcwd(pchar(SystemPath),siz)));
|
|
|
|
+ SetCodePage(FpGetcwd,DefaultFileSystemCodePage,false);
|
|
End;
|
|
End;
|
|
}
|
|
}
|
|
-Function FpGetcwd :AnsiString;
|
|
|
|
|
|
+Function FpGetcwd: RawByteString;
|
|
|
|
|
|
Var
|
|
Var
|
|
Buf : Array[0..PATH_MAX+1] of char;
|
|
Buf : Array[0..PATH_MAX+1] of char;
|
|
@@ -56,59 +76,93 @@ Begin
|
|
If FpGetcwd(@Buf[0],PATH_MAX)=Nil then
|
|
If FpGetcwd(@Buf[0],PATH_MAX)=Nil then
|
|
FpGetcwd:=''
|
|
FpGetcwd:=''
|
|
else
|
|
else
|
|
- FpGetcwd:=Buf;
|
|
|
|
|
|
+ begin
|
|
|
|
+ FpGetcwd:=Buf;
|
|
|
|
+ SetCodePage(FpGetcwd,DefaultFileSystemCodePage,false);
|
|
|
|
+ end;
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpExecve (path : AnsiString; argv : ppchar; envp: ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpExecve (const path : RawByteString; argv : ppchar; envp: ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpExecve:=FpExecve (pchar(path),argv,envp);
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpExecve:=FpExecve (pchar(SystemPath),argv,envp);
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpExecv (path : AnsiString; argv : ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpExecv (const path : RawByteString; argv : ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpExecv:=FpExecve (pchar(path),argv,envp);
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpExecv:=FpExecve (pchar(SystemPath),argv,envp);
|
|
End;
|
|
End;
|
|
|
|
|
|
|
|
|
|
-Function FpChdir (path : AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpChdir (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpChDir:=FpChdir(pchar(Path));
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpChDir:=FpChdir(pchar(SystemPath));
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpOpen (path : AnsiString; flags : cInt; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpOpen (const path : RawByteString; flags : cInt; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpOpen:=FpOpen(pchar(Path),flags,mode);
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpOpen:=FpOpen(pchar(SystemPath),flags,mode);
|
|
End;
|
|
End;
|
|
|
|
|
|
|
|
|
|
-Function FpMkdir (path : AnsiString; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpMkdir (const path : RawByteString; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpMkdir:=FpMkdir(pchar(Path),mode);
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpMkdir:=FpMkdir(pchar(SystemPath),mode);
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpUnlink (path : AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpUnlink (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpUnlink:=FpUnlink(pchar(path));
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpUnlink:=FpUnlink(pchar(SystemPath));
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpRmdir (path : AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpRmdir (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpRmdir:=FpRmdir(pchar(path));
|
|
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpRmdir:=FpRmdir(pchar(SystemPath));
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpRename (old : AnsiString;newpath: AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpRename (const old : RawByteString; const newpath: RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ OldSystemPath, NewSystemPath: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpRename:=FpRename(pchar(old),pchar(newpath));
|
|
|
|
|
|
+ OldSystemPath:=ToSingleByteFileSystemEncodedFileName(old);
|
|
|
|
+ NewSystemPath:=ToSingleByteFileSystemEncodedFileName(newpath);
|
|
|
|
+ FpRename:=FpRename(pchar(OldSystemPath),pchar(NewSystemPath));
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function FpStat (path: AnsiString; var buf : stat): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
-begin
|
|
|
|
- FpStat:=FpStat(pchar(path),buf);
|
|
|
|
|
|
+Function FpStat (const path: RawByteString; var buf : stat): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
|
|
+Begin
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpStat:=FpStat(pchar(SystemPath),buf);
|
|
End;
|
|
End;
|
|
|
|
|
|
-Function fpLstat (path: Ansistring; Info: pstat):cint; inline;
|
|
|
|
-begin
|
|
|
|
- fplstat:=fplstat(pchar(path), info);
|
|
|
|
|
|
+Function fpLstat (const path: RawByteString; Info: pstat):cint; inline;
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
|
|
+Begin
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ fplstat:=fplstat(pchar(SystemPath), info);
|
|
end;
|
|
end;
|
|
|
|
|
|
Function fpLstat (path:pchar;var Info:stat):cint; inline;
|
|
Function fpLstat (path:pchar;var Info:stat):cint; inline;
|
|
@@ -117,15 +171,17 @@ begin
|
|
fpLstat:=fplstat(path,@info);
|
|
fpLstat:=fplstat(path,@info);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function fpLstat (Filename: ansistring;var Info:stat):cint; inline;
|
|
|
|
-
|
|
|
|
-begin
|
|
|
|
|
|
+Function fpLstat (const Filename: RawByteString;var Info:stat):cint; inline;
|
|
|
|
+Begin
|
|
fpLstat:=fplstat(filename,@info);
|
|
fpLstat:=fplstat(filename,@info);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function FpAccess (pathname : AnsiString; aMode : cInt): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpAccess (const pathname : RawByteString; aMode : cInt): cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPathName: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpAccess:=FpAccess(pchar(pathname),amode);
|
|
|
|
|
|
+ SystemPathName:=ToSingleByteFileSystemEncodedFileName(pathname);
|
|
|
|
+ FpAccess:=FpAccess(pchar(SystemPathName),amode);
|
|
End;
|
|
End;
|
|
|
|
|
|
Function FPFStat(var F:Text;Var Info:stat):Boolean; {$ifdef VER2_0}inline;{$endif}
|
|
Function FPFStat(var F:Text;Var Info:stat):Boolean; {$ifdef VER2_0}inline;{$endif}
|
|
@@ -201,10 +257,12 @@ begin
|
|
FpOpen:=FpOpen(path,flags,438);
|
|
FpOpen:=FpOpen(path,flags,438);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function FpOpen (path : AnsiString; flags : cInt):cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
-
|
|
|
|
-begin
|
|
|
|
- FpOpen:=FpOpen(pchar(path),flags,438);
|
|
|
|
|
|
+Function FpOpen (const path : RawByteString; flags : cInt):cInt; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemPath: RawByteString;
|
|
|
|
+Begin
|
|
|
|
+ SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
|
|
|
+ FpOpen:=FpOpen(pchar(SystemPath),flags,438);
|
|
end;
|
|
end;
|
|
|
|
|
|
Function FpOpen (path : String; flags : cInt):cInt;
|
|
Function FpOpen (path : String; flags : cInt):cInt;
|
|
@@ -221,9 +279,12 @@ begin
|
|
FpOpen:=FpOpen(@path[1],flags,Mode);
|
|
FpOpen:=FpOpen(@path[1],flags,Mode);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function FpOpendir (dirname : AnsiString): pDir; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
|
|
+Function FpOpendir (const dirname : RawByteString): pDir; {$ifdef VER2_0}inline;{$endif}
|
|
|
|
+var
|
|
|
|
+ SystemDirName: RawByteString;
|
|
Begin
|
|
Begin
|
|
- FpOpenDir:=FpOpenDir(pchar(dirname));
|
|
|
|
|
|
+ SystemDirName:=ToSingleByteFileSystemEncodedFileName(dirname);
|
|
|
|
+ FpOpenDir:=FpOpenDir(pchar(SystemDirName));
|
|
End;
|
|
End;
|
|
|
|
|
|
|
|
|
|
@@ -373,20 +434,21 @@ begin
|
|
fpWaitPID:=fpWaitPID(Pid,@Status,Options);
|
|
fpWaitPID:=fpWaitPID(Pid,@Status,Options);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function fpReadLink(Name:ansistring):ansistring;
|
|
|
|
|
|
+Function fpReadLink(const Name: RawByteString): RawByteString;
|
|
{
|
|
{
|
|
Read a link (where it points to)
|
|
Read a link (where it points to)
|
|
}
|
|
}
|
|
var
|
|
var
|
|
- LinkName : ansistring;
|
|
|
|
|
|
+ SystemFileName : RawByteString;
|
|
i : cint;
|
|
i : cint;
|
|
begin
|
|
begin
|
|
- SetLength(linkname,PATH_MAX);
|
|
|
|
- i:=fpReadLink(pchar(name),pchar(linkname),PATH_MAX);
|
|
|
|
|
|
+ SetLength(fpReadLink,PATH_MAX);
|
|
|
|
+ SystemFileName:=ToSingleByteFileSystemEncodedFileName(Name);
|
|
|
|
+ i:=fpReadLink(pchar(SystemFileName),pchar(fpReadLink),PATH_MAX);
|
|
if i>0 then
|
|
if i>0 then
|
|
begin
|
|
begin
|
|
- SetLength(linkname,i);
|
|
|
|
- fpReadLink:=LinkName;
|
|
|
|
|
|
+ SetLength(fpReadLink,i);
|
|
|
|
+ SetCodePage(fpReadLink,DefaultFileSystemCodePage,false);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
fpReadLink:='';
|
|
fpReadLink:='';
|