mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 00:39:34 +02:00
+ Added fileIsReadOnly
This commit is contained in:
parent
a23c7932cf
commit
dc953332cd
@ -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
|
||||
|
@ -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 }
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user