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

2015-06-17 Thread Fred van Stappen
> 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 In

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

2015-06-17 Thread Graeme Geldenhuys
On 2015-06-17 16:00, fredvs wrote: > And you give me choice...;-) > I will study your tips and then choose one of them... Fred, the tiSetFileReadOnly() I sent you the other day already uses fpstat() before checking/setting the read-only flag. So you are halfway there. ;-) Regards, - Graeme - -

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

2015-06-17 Thread Karoly Balogh (Charlie/SGR)
Hi, On Wed, 17 Jun 2015, fredvs wrote: > But how to check if a file has executable permission (and if not, change it > with fpchmod(thefile S_IRWXU);) ? >From the top of my head: fpStat(), and in the returned stat structure, look for the mode field (or st_mode?). There are more useful bits in th

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

2015-06-17 Thread fredvs
@ Bart and Ewald. => excellent, many thanks. And you give me choice...;-) I will study your tips and then choose one of them... Many thanks. Fre;D - Many thanks ;-) -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/How-to-get-the-permission-f-a-file-tp572

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

2015-06-17 Thread Ewald
On 06/17/2015 04:42 PM, fredvs wrote: > But how to check if a file has executable permission (and if not, change it > with fpchmod(thefile S_IRWXU);) ? stat? See: http://linux.die.net/man/2/stat http://www.freepascal.org/docs-html/rtl/baseunix/fpstat.html http://www.freepascal.org/docs

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

2015-06-17 Thread Bart
On 6/17/15, fredvs 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 execut

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

2015-06-17 Thread fredvs
Hello. With fpchmod(), it is possible to change the permission of a file. Perfect. But how to check if a file has executable permission (and if not, change it with fpchmod(thefile S_IRWXU);) ? Many thanks. Fre;D - Many thanks ;-) -- View this message in context: http://free-pascal-g