On 6/17/15, fredvs <fi...@hotmail.com> wrote: > But how to check if a file has executable permission (and if not, change it > with fpchmod(thefile S_IRWXU);) ?
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; (From LazFileUtils unit of Lazarus) Bart _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal