you might also have a look at jna.dev.java.net as they have some trickery
that allows you to query is a file is executable

2009/10/27 Rebhan, Gilbert <[email protected]>

>
>
>
>
> -----Original Message-----
> From: Francis GALIEGUE [mailto:[email protected]]
> Sent: Friday, October 23, 2009 10:01 PM
> To: Ant Users List
> Subject: Checking whether a file is executable
>
> /*
> Hello,
>
> Ant's <available> condition can check whether a file exists and is a
> regular file (with type="file"), but I have seen no condition that can
> tell me whether a given regular file is executable (sorry for the Unix
> speak - FWIW, a regular file is just that, a file - a directory is
> just another type of file).
>
> Java has .canExecute() which can tell whether a given File object is
> executable. Where should I start to look if I want to create, say, a
> <isexecutabe> condition? Or is there something existing that I just
> overlooked? I could use <exec> and work out the return value, but I'd
> be better off if I could fail earlier, finding that a given file is
> just not executable at all...
> */
>
> another possibility would be to check, whether the file is binary, see =
> http://marc.info/?l=ant-user&m=118769231408319&w=2
>
>
>
> Regards, Gilbert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to