mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-26 08:31:46 +01:00
* ansistring versions of mk/rm/chdir in objpas, Mantis 15010. The os-dependant routines of *nix/os2/win/dos have been converted
git-svn-id: trunk@14211 -
This commit is contained in:
parent
656f122bef
commit
17062d667c
@ -18,21 +18,18 @@
|
|||||||
Directory Handling
|
Directory Handling
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
procedure DosDir(func:byte;const s:string);
|
procedure DosDir(func:byte;s:pchar;len:integer);
|
||||||
var
|
var
|
||||||
buffer : array[0..255] of char;
|
|
||||||
regs : trealregs;
|
regs : trealregs;
|
||||||
begin
|
begin
|
||||||
move(s[1],buffer,length(s));
|
DoDirSeparators(s);
|
||||||
buffer[length(s)]:=#0;
|
|
||||||
DoDirSeparators(pchar(@buffer));
|
|
||||||
{ True DOS does not like backslashes at end
|
{ True DOS does not like backslashes at end
|
||||||
Win95 DOS accepts this !!
|
Win95 DOS accepts this !!
|
||||||
but "\" and "c:\" should still be kept and accepted hopefully PM }
|
but "\" and "c:\" should still be kept and accepted hopefully PM }
|
||||||
if (length(s)>0) and (buffer[length(s)-1]='\') and
|
if (len>0) and (s[len-1]='\') and
|
||||||
Not ((length(s)=1) or ((length(s)=3) and (s[2]=':'))) then
|
Not ((len=1) or ((len=3) and (s[1]=':'))) then
|
||||||
buffer[length(s)-1]:=#0;
|
s[len-1]:=#0;
|
||||||
syscopytodos(longint(@buffer),length(s)+1);
|
syscopytodos(longint(s),len+1);
|
||||||
regs.realedx:=tb_offset;
|
regs.realedx:=tb_offset;
|
||||||
regs.realds:=tb_segment;
|
regs.realds:=tb_segment;
|
||||||
if LFNSupport then
|
if LFNSupport then
|
||||||
@ -44,35 +41,32 @@ begin
|
|||||||
GetInOutRes(lo(regs.realeax));
|
GetInOutRes(lo(regs.realeax));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure MkDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_MKDIR'];
|
||||||
procedure mkdir(const s : string);[IOCheck];
|
|
||||||
begin
|
begin
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
DosDir($39,s);
|
DosDir($39,s,len);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure RmDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_RMDIR'];
|
||||||
procedure rmdir(const s : string);[IOCheck];
|
|
||||||
begin
|
begin
|
||||||
if (s = '.' ) then
|
if (len=1) and (s[0] = '.' ) then
|
||||||
InOutRes := 16;
|
InOutRes := 16;
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
DosDir($3a,s);
|
DosDir($3a,s,len);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure ChDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_CHDIR'];
|
||||||
procedure chdir(const s : string);[IOCheck];
|
|
||||||
var
|
var
|
||||||
regs : trealregs;
|
regs : trealregs;
|
||||||
begin
|
begin
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
{ First handle Drive changes }
|
{ First handle Drive changes }
|
||||||
if (length(s)>=2) and (s[2]=':') then
|
if (len>=2) and (s[1]=':') then
|
||||||
begin
|
begin
|
||||||
regs.realedx:=(ord(s[1]) and (not 32))-ord('A');
|
regs.realedx:=(ord(s[0]) and (not 32))-ord('A');
|
||||||
regs.realeax:=$0e00;
|
regs.realeax:=$0e00;
|
||||||
sysrealintr($21,regs);
|
sysrealintr($21,regs);
|
||||||
regs.realeax:=$1900;
|
regs.realeax:=$1900;
|
||||||
@ -84,14 +78,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
{ DosDir($3b,'c:') give Path not found error on
|
{ DosDir($3b,'c:') give Path not found error on
|
||||||
pure DOS PM }
|
pure DOS PM }
|
||||||
if length(s)=2 then
|
if len=2 then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{ do the normal dos chdir }
|
{ do the normal dos chdir }
|
||||||
DosDir($3b,s);
|
DosDir($3b,s,len);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure GetDir (DriveNr: byte; var Dir: ShortString);
|
procedure GetDir (DriveNr: byte; var Dir: ShortString);
|
||||||
var
|
var
|
||||||
temp : array[0..255] of char;
|
temp : array[0..255] of char;
|
||||||
|
|||||||
@ -588,21 +588,6 @@ Begin
|
|||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
|
||||||
Directory support.
|
|
||||||
*****************************************************************************}
|
|
||||||
|
|
||||||
{$if defined(FPC_HAS_FEATURE_FILEIO) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
|
|
||||||
Procedure getdir(drivenr:byte;Var dir:ansistring);
|
|
||||||
{ this is needed to also allow ansistrings, the shortstring version is
|
|
||||||
OS dependent }
|
|
||||||
var
|
|
||||||
s : shortstring;
|
|
||||||
begin
|
|
||||||
getdir(drivenr,s);
|
|
||||||
dir:=s;
|
|
||||||
end;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
{$ifopt R+}
|
{$ifopt R+}
|
||||||
{$define RangeCheckWasOn}
|
{$define RangeCheckWasOn}
|
||||||
@ -1340,6 +1325,54 @@ end;
|
|||||||
{ OS dependent dir functions }
|
{ OS dependent dir functions }
|
||||||
{$i sysdir.inc}
|
{$i sysdir.inc}
|
||||||
|
|
||||||
|
{$if defined(FPC_HAS_FEATURE_FILEIO) and defined(FPC_HAS_FEATURE_ANSISTRINGS)}
|
||||||
|
Procedure getdir(drivenr:byte;Var dir:ansistring);
|
||||||
|
{ this is needed to also allow ansistrings, the shortstring version is
|
||||||
|
OS dependent }
|
||||||
|
var
|
||||||
|
s : shortstring;
|
||||||
|
begin
|
||||||
|
getdir(drivenr,s);
|
||||||
|
dir:=s;
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
{$if defined(FPC_HAS_FEATURE_FILEIO)}
|
||||||
|
|
||||||
|
Procedure MkDir(Const s: String);
|
||||||
|
Var
|
||||||
|
Buffer: Array[0..255] of Char;
|
||||||
|
Begin
|
||||||
|
If (s='') or (InOutRes <> 0) then
|
||||||
|
exit;
|
||||||
|
Move(s[1], Buffer, Length(s));
|
||||||
|
Buffer[Length(s)] := #0;
|
||||||
|
MkDir(@buffer[0],length(s));
|
||||||
|
End;
|
||||||
|
|
||||||
|
Procedure RmDir(Const s: String);
|
||||||
|
Var
|
||||||
|
Buffer: Array[0..255] of Char;
|
||||||
|
Begin
|
||||||
|
If (s='') or (InOutRes <> 0) then
|
||||||
|
exit;
|
||||||
|
Move(s[1], Buffer, Length(s));
|
||||||
|
Buffer[Length(s)] := #0;
|
||||||
|
RmDir(@buffer[0],length(s));
|
||||||
|
End;
|
||||||
|
|
||||||
|
Procedure ChDir(Const s: String);
|
||||||
|
Var
|
||||||
|
Buffer: Array[0..255] of Char;
|
||||||
|
Begin
|
||||||
|
If (s='') or (InOutRes <> 0) then
|
||||||
|
exit;
|
||||||
|
Move(s[1], Buffer, Length(s));
|
||||||
|
Buffer[Length(s)] := #0;
|
||||||
|
ChDir(@buffer[0],length(s));
|
||||||
|
End;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
Resources support
|
Resources support
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|||||||
@ -874,16 +874,17 @@ Procedure SetTextLineEnding(var f:Text; Ending:string);
|
|||||||
|
|
||||||
|
|
||||||
{$ifdef FPC_HAS_FEATURE_FILEIO}
|
{$ifdef FPC_HAS_FEATURE_FILEIO}
|
||||||
Procedure chdir(const s:string);
|
Procedure chdir(const s:string); overload;
|
||||||
Procedure mkdir(const s:string);
|
Procedure mkdir(const s:string); overload;
|
||||||
Procedure rmdir(const s:string);
|
Procedure rmdir(const s:string); overload;
|
||||||
|
// the pchar versions are exported via alias for use in objpas
|
||||||
|
|
||||||
Procedure getdir(drivenr:byte;var dir:shortstring);
|
Procedure getdir(drivenr:byte;var dir:shortstring);
|
||||||
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
|
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
Procedure getdir(drivenr:byte;var dir:ansistring);
|
Procedure getdir(drivenr:byte;var dir:ansistring);
|
||||||
{$endif FPC_HAS_FEATURE_ANSISTRINGS}
|
{$endif FPC_HAS_FEATURE_ANSISTRINGS}
|
||||||
{$endif FPC_HAS_FEATURE_FILEIO}
|
{$endif FPC_HAS_FEATURE_FILEIO}
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
Miscellaneous
|
Miscellaneous
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|||||||
@ -70,6 +70,10 @@ Var
|
|||||||
{ ParamStr should return also an ansistring }
|
{ ParamStr should return also an ansistring }
|
||||||
Function ParamStr(Param : Integer) : Ansistring;
|
Function ParamStr(Param : Integer) : Ansistring;
|
||||||
|
|
||||||
|
Procedure MkDir(const s:ansistring);overload;
|
||||||
|
Procedure RmDir(const s:ansistring);overload;
|
||||||
|
Procedure ChDir(const s:ansistring);overload;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Resource strings.
|
Resource strings.
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -104,6 +108,10 @@ Var
|
|||||||
Compatibility routines.
|
Compatibility routines.
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
|
Procedure MkDirpchar(s: pchar;len:sizeuint);[IOCheck]; external name 'FPC_SYS_MKDIR';
|
||||||
|
Procedure ChDirpchar(s: pchar;len:sizeuint);[IOCheck]; external name 'FPC_SYS_CHDIR';
|
||||||
|
Procedure RmDirpchar(s: pchar;len:sizeuint);[IOCheck]; external name 'FPC_SYS_RMDIR';
|
||||||
|
|
||||||
{ Untyped file support }
|
{ Untyped file support }
|
||||||
|
|
||||||
Procedure AssignFile(out f:File;const Name:string);
|
Procedure AssignFile(out f:File;const Name:string);
|
||||||
@ -207,6 +215,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure MkDir(const s:ansistring);
|
||||||
|
begin
|
||||||
|
mkdirpchar(pchar(s),length(s));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure RmDir(const s:ansistring);
|
||||||
|
begin
|
||||||
|
RmDirpchar(pchar(s),length(s));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure ChDir(const s:ansistring);
|
||||||
|
begin
|
||||||
|
ChDirpchar(pchar(s),length(s));
|
||||||
|
end;
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
ResourceString support
|
ResourceString support
|
||||||
|
|||||||
@ -19,64 +19,57 @@
|
|||||||
Directory Handling
|
Directory Handling
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
procedure MkDir (const S: string);[IOCHECK];
|
Procedure MkDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_MKDIR'];
|
||||||
var buffer:array[0..255] of char;
|
var
|
||||||
Rc : word;
|
Rc : word;
|
||||||
begin
|
begin
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
move(s[1],buffer,length(s));
|
DoDirSeparators(s);
|
||||||
buffer[length(s)]:=#0;
|
Rc := DosCreateDir(s,nil);
|
||||||
DoDirSeparators(Pchar(@buffer));
|
if Rc <> 0 then
|
||||||
Rc := DosCreateDir(buffer,nil);
|
begin
|
||||||
if Rc <> 0 then
|
InOutRes := Rc;
|
||||||
begin
|
Errno2Inoutres;
|
||||||
InOutRes := Rc;
|
end;
|
||||||
Errno2Inoutres;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure RmDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_RMDIR'];
|
||||||
procedure rmdir(const s : string);[IOCHECK];
|
var
|
||||||
var buffer:array[0..255] of char;
|
|
||||||
Rc : word;
|
Rc : word;
|
||||||
begin
|
begin
|
||||||
if (s = '.' ) then
|
if (len=1) and (s^ = '.' ) then
|
||||||
InOutRes := 16;
|
InOutRes := 16;
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
move(s[1],buffer,length(s));
|
DoDirSeparators(s);
|
||||||
buffer[length(s)]:=#0;
|
Rc := DosDeleteDir(s);
|
||||||
DoDirSeparators(Pchar(@buffer));
|
if Rc <> 0 then
|
||||||
Rc := DosDeleteDir(buffer);
|
begin
|
||||||
if Rc <> 0 then
|
InOutRes := Rc;
|
||||||
begin
|
Errno2Inoutres;
|
||||||
InOutRes := Rc;
|
end;
|
||||||
Errno2Inoutres;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ASMMODE INTEL}
|
{$ASMMODE INTEL}
|
||||||
|
|
||||||
procedure ChDir (const S: string);[IOCheck];
|
Procedure ChDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_CHDIR'];
|
||||||
|
|
||||||
var RC: cardinal;
|
var RC: cardinal;
|
||||||
Buffer: array [0..255] of char;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
If (s='') or (InOutRes <> 0) then exit;
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
if (Length (S) >= 2) and (S [2] = ':') then
|
exit;
|
||||||
|
if (Len >= 2) and (S[1] = ':') then
|
||||||
begin
|
begin
|
||||||
RC := DosSetDefaultDisk ((Ord (S [1]) and not ($20)) - $40);
|
RC := DosSetDefaultDisk ((Ord (S [0]) and not ($20)) - $40);
|
||||||
if RC <> 0 then
|
if RC <> 0 then
|
||||||
InOutRes := RC
|
InOutRes := RC
|
||||||
else
|
else
|
||||||
if Length (S) > 2 then
|
if Len > 2 then
|
||||||
begin
|
begin
|
||||||
Move (S [1], Buffer, Length (S));
|
DoDirSeparators (s);
|
||||||
Buffer [Length (S)] := #0;
|
RC := DosSetCurrentDir (s);
|
||||||
DoDirSeparators (PChar (@Buffer));
|
|
||||||
RC := DosSetCurrentDir (@Buffer);
|
|
||||||
if RC <> 0 then
|
if RC <> 0 then
|
||||||
begin
|
begin
|
||||||
InOutRes := RC;
|
InOutRes := RC;
|
||||||
@ -84,10 +77,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
Move (S [1], Buffer, Length (S));
|
DoDirSeparators (s);
|
||||||
Buffer [Length (S)] := #0;
|
RC := DosSetCurrentDir (s);
|
||||||
DoDirSeparators (PChar (@Buffer));
|
|
||||||
RC := DosSetCurrentDir (@Buffer);
|
|
||||||
if RC <> 0 then
|
if RC <> 0 then
|
||||||
begin
|
begin
|
||||||
InOutRes:= RC;
|
InOutRes:= RC;
|
||||||
|
|||||||
@ -18,53 +18,44 @@
|
|||||||
Directory Handling
|
Directory Handling
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
Procedure MkDir(Const s: String);[IOCheck];
|
Procedure MkDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_MKDIR'];
|
||||||
const
|
const
|
||||||
{ read/write search permission for everyone }
|
{ read/write search permission for everyone }
|
||||||
MODE_MKDIR = S_IWUSR OR S_IRUSR OR
|
MODE_MKDIR = S_IWUSR OR S_IRUSR OR
|
||||||
S_IWGRP OR S_IRGRP OR
|
S_IWGRP OR S_IRGRP OR
|
||||||
S_IWOTH OR S_IROTH OR
|
S_IWOTH OR S_IROTH OR
|
||||||
S_IXUSR OR S_IXGRP OR S_IXOTH;
|
S_IXUSR OR S_IXGRP OR S_IXOTH;
|
||||||
Var
|
|
||||||
Buffer: Array[0..255] of Char;
|
// len is not passed to the *nix functions because the unix API doesn't
|
||||||
|
// use length safeguards for these functions. (probably because there
|
||||||
|
// already is a length limit due to PATH_MAX)
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
Move(s[1], Buffer, Length(s));
|
If Fpmkdir(s, MODE_MKDIR)<0 Then
|
||||||
Buffer[Length(s)] := #0;
|
|
||||||
If Fpmkdir(@buffer[0], MODE_MKDIR)<0 Then
|
|
||||||
Errno2Inoutres
|
Errno2Inoutres
|
||||||
Else
|
Else
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Procedure RmDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_RMDIR'];
|
||||||
Procedure RmDir(Const s: String);[IOCheck];
|
|
||||||
Var
|
|
||||||
Buffer: Array[0..255] of Char;
|
|
||||||
Begin
|
Begin
|
||||||
if (s = '.') then
|
if (len=1) and (s^ = '.') then
|
||||||
InOutRes := 16;
|
InOutRes := 16;
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
Move(s[1], Buffer, Length(s));
|
If Fprmdir(s)<0 Then
|
||||||
Buffer[Length(s)] := #0;
|
|
||||||
If Fprmdir(@buffer[0])<0 Then
|
|
||||||
Errno2Inoutres
|
Errno2Inoutres
|
||||||
Else
|
Else
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Procedure ChDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_CHDIR'];
|
||||||
Procedure ChDir(Const s: String);[IOCheck];
|
|
||||||
Var
|
|
||||||
Buffer: Array[0..255] of Char;
|
|
||||||
Begin
|
Begin
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
Move(s[1], Buffer, Length(s));
|
If Fpchdir(s)<0 Then
|
||||||
Buffer[Length(s)] := #0;
|
|
||||||
If Fpchdir(@buffer[0])<0 Then
|
|
||||||
Errno2Inoutres
|
Errno2Inoutres
|
||||||
Else
|
Else
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
|||||||
@ -17,18 +17,13 @@
|
|||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
Directory Handling
|
Directory Handling
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
type
|
type
|
||||||
TDirFnType=function(name:pointer):longbool;stdcall;
|
TDirFnType=function(name:pointer):longbool;stdcall;
|
||||||
|
|
||||||
procedure dirfn(afunc : TDirFnType;const s:string);
|
procedure dirfn(afunc : TDirFnType;s:pchar;len:integer);
|
||||||
var
|
|
||||||
buffer : array[0..255] of char;
|
|
||||||
begin
|
begin
|
||||||
move(s[1],buffer,length(s));
|
DoDirSeparators(s);
|
||||||
buffer[length(s)]:=#0;
|
if not aFunc(s) then
|
||||||
DoDirSeparators(pchar(@buffer));
|
|
||||||
if not aFunc(@buffer) then
|
|
||||||
begin
|
begin
|
||||||
errno:=GetLastError;
|
errno:=GetLastError;
|
||||||
Errno2InoutRes;
|
Errno2InoutRes;
|
||||||
@ -40,36 +35,38 @@ begin
|
|||||||
CreateDirectoryTrunc:=CreateDirectory(name,nil);
|
CreateDirectoryTrunc:=CreateDirectory(name,nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure mkdir(const s:string);[IOCHECK];
|
Procedure MkDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_MKDIR'];
|
||||||
begin
|
begin
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
dirfn(TDirFnType(@CreateDirectoryTrunc),s);
|
dirfn(TDirFnType(@CreateDirectoryTrunc),s,len);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure rmdir(const s:string);[IOCHECK];
|
Procedure RmDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_RMDIR'];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (s ='.') then
|
if (len=1) and (s^ ='.') then
|
||||||
InOutRes := 16;
|
InOutRes := 16;
|
||||||
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
|
exit;
|
||||||
{$ifdef WINCE}
|
{$ifdef WINCE}
|
||||||
if (s ='..') then
|
if (len=2) and (s[0]='.') and (s[1]='.') then
|
||||||
InOutRes := 5;
|
InOutRes := 5;
|
||||||
{$endif WINCE}
|
{$endif WINCE}
|
||||||
If (s='') or (InOutRes <> 0) then
|
dirfn(TDirFnType(@RemoveDirectory),s,len);
|
||||||
exit;
|
|
||||||
dirfn(TDirFnType(@RemoveDirectory),s);
|
|
||||||
{$ifdef WINCE}
|
{$ifdef WINCE}
|
||||||
if (Inoutres=3) and (Pos(DirectorySeparator, s)<2) then
|
if (Inoutres=3) and (Pos(DirectorySeparator, s)<2) then
|
||||||
Inoutres:=2;
|
Inoutres:=2;
|
||||||
{$endif WINCE}
|
{$endif WINCE}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure chdir(const s:string);[IOCHECK];
|
Procedure ChDir(s: pchar;len:sizeuint);[IOCheck, public, alias : 'FPC_SYS_CHDIR'];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$ifndef WINCE}
|
{$ifndef WINCE}
|
||||||
If (s='') or (InOutRes <> 0) then
|
If not assigned(s) or (len=0) or (InOutRes <> 0) then
|
||||||
exit;
|
exit;
|
||||||
dirfn(TDirFnType(@SetCurrentDirectory),s);
|
dirfn(TDirFnType(@SetCurrentDirectory),s,len);
|
||||||
if Inoutres=2 then
|
if Inoutres=2 then
|
||||||
Inoutres:=3;
|
Inoutres:=3;
|
||||||
{$else WINCE}
|
{$else WINCE}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user