mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 09:11:53 +01: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 DeleteFile (Const FileName : String) : Boolean; | ||||||
| Function RenameFile (Const OldName, NewName : String) : Boolean; | Function RenameFile (Const OldName, NewName : String) : Boolean; | ||||||
| Function FileSearch (Const Name, DirList : String) : String; | Function FileSearch (Const Name, DirList : String) : String; | ||||||
|  | Function FileIsReadOnly(const FileName: String): Boolean;  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   $Log$ |   $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 |     * moved classes unit to rtl | ||||||
| 
 | 
 | ||||||
|   Revision 1.10  2003/04/01 15:57:41  peter |   Revision 1.10  2003/04/01 15:57:41  peter | ||||||
|  | |||||||
| @ -46,6 +46,15 @@ | |||||||
|       until (length(temp)=0) or (length(result)<>0); |       until (length(temp)=0) or (length(result)<>0); | ||||||
|     end; |     end; | ||||||
| 
 | 
 | ||||||
|  |   {$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 } |   { Read String Handling functions implementation } | ||||||
|   {$i sysstr.inc} |   {$i sysstr.inc} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -35,6 +35,8 @@ implementation | |||||||
| 
 | 
 | ||||||
| Uses UnixUtil,Baseunix; | Uses UnixUtil,Baseunix; | ||||||
| 
 | 
 | ||||||
|  | {$Define OS_FILEISREADONLY} // Specific implementation for Unix. | ||||||
|  | 
 | ||||||
| { Include platform independent implementation part } | { Include platform independent implementation part } | ||||||
| {$i sysutils.inc} | {$i sysutils.inc} | ||||||
| 
 | 
 | ||||||
| @ -316,6 +318,11 @@ begin | |||||||
|   RenameFile:=BaseUnix.FpRename(OldNAme,NewName)>=0; |   RenameFile:=BaseUnix.FpRename(OldNAme,NewName)>=0; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
|  | Function FileIsReadOnly(const FileName: String): Boolean;  | ||||||
|  |   | ||||||
|  | begin | ||||||
|  |   Result := fpAccess(PChar(FileName),W_OK)= 0; | ||||||
|  | end;   | ||||||
| 
 | 
 | ||||||
| {**************************************************************************** | {**************************************************************************** | ||||||
|                               Disk Functions |                               Disk Functions | ||||||
| @ -564,7 +571,10 @@ end. | |||||||
| { | { | ||||||
| 
 | 
 | ||||||
|   $Log$ |   $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 |   + Implemented getlastoserror | ||||||
| 
 | 
 | ||||||
|   Revision 1.31  2004/01/20 23:13:53  hajny |   Revision 1.31  2004/01/20 23:13:53  hajny | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 michael
						michael