[fpc-pascal] How to get the permission f a file ?

Fred van Stappen fiens at hotmail.com
Thu Jun 18 01:36:56 CEST 2015


> Fred, the tiSetFileReadOnly() I sent you the other day already uses
> fpstat() before checking/setting the read-only flag. So you are halfway
> there. ;-)

Yep, many thanks. ;-)

PS: Bart's tip works like lovely charm... =>

function FileIsExecutable(const AFilename: string): boolean;

var

  Info : Stat;

begin

  // first check AFilename is not a directory and then check if executable

  Result:= (FpStat(AFilename,info{%H-})<>-1) and FPS_ISREG(info.st_mode) and

           (BaseUnix.FpAccess(AFilename,BaseUnix.X_OK)=0);

end;


Fre;D
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150618/1ca3ea67/attachment.html>


More information about the fpc-pascal mailing list