+ Added fileIsReadOnly

This commit is contained in:
michael 2004-02-08 14:50:51 +00:00
parent a23c7932cf
commit dc953332cd
3 changed files with 26 additions and 3 deletions

View File

@ -78,11 +78,15 @@ Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
Function DeleteFile (Const FileName : String) : Boolean;
Function RenameFile (Const OldName, NewName : String) : Boolean;
Function FileSearch (Const Name, DirList : String) : String;
Function FileIsReadOnly(const FileName: String): Boolean;
{
$Log$
Revision 1.1 2003-10-06 21:01:06 peter
Revision 1.2 2004-02-08 14:50:51 michael
+ Added fileIsReadOnly
Revision 1.1 2003/10/06 21:01:06 peter
* moved classes unit to rtl
Revision 1.10 2003/04/01 15:57:41 peter

View File

@ -46,7 +46,16 @@
until (length(temp)=0) or (length(result)<>0);
end;
{ Read String Handling functions implementation }
{$ifndef OS_FILEISREADONLY}
Function FileIsReadOnly(const FileName: String): Boolean;
begin
Result := (FileGetAttr(FileName) and faReadOnly) <> 0;
end;
{$endif OS_FILEISREADONLY}
{ Read String Handling functions implementation }
{$i sysstr.inc}
{ Read date & Time function implementations }

View File

@ -35,6 +35,8 @@ implementation
Uses UnixUtil,Baseunix;
{$Define OS_FILEISREADONLY} // Specific implementation for Unix.
{ Include platform independent implementation part }
{$i sysutils.inc}
@ -316,6 +318,11 @@ begin
RenameFile:=BaseUnix.FpRename(OldNAme,NewName)>=0;
end;
Function FileIsReadOnly(const FileName: String): Boolean;
begin
Result := fpAccess(PChar(FileName),W_OK)= 0;
end;
{****************************************************************************
Disk Functions
@ -564,7 +571,10 @@ end.
{
$Log$
Revision 1.32 2004-02-08 11:01:17 michael
Revision 1.33 2004-02-08 14:50:51 michael
+ Added fileIsReadOnly
Revision 1.32 2004/02/08 11:01:17 michael
+ Implemented getlastoserror
Revision 1.31 2004/01/20 23:13:53 hajny