ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Janes <pet...@liberate.com>
Subject Re: [SUBMIT] Attrib task (chmod for Windows)
Date Fri, 25 Jan 2002 17:47:06 GMT
Rob Oxspring wrote:
 > Why should Chmod.java and Attrib.java force an operating system
 > precondition?

Taking this a step further, why couldn't this be handled in a more 
general-purpose, inclusive manner?  Define attributes that can apply to 
files, actions for each platform to which they apply, and a factory that 
translates them appropriately.  Ignore (or warn about) attributes that 
aren't supported.  It then isn't a matter of "what native tool can I use on 
platform X", but "what does platform X support".  (I haven't looked much at 
the VFS proposals for Ant2, but I'm guessing they handle things this way.)

As a simple example, take something like

<set-permissions
   file="foo"
   executable="true"
   readonly="true"
   hidden="true"
/>

On Windows (which doesn't have "executable" files) this would translate to

   attrib +r +h foo

On UNIX (which doesn't have "hidden" files) it would become

   chmod 0555 foo

Mac probably doesn't have executable or hidden files, so it would just set 
the read-only attribute.  Similarly for Netware, Be, etc.

If more fine-grained control is necessary, either use "exec" for your 
platform of choice or add user-specified attributes like <java>'s <jvmargs>.

Peter J.


Rob Oxspring wrote:
> Why should Chmod.java and Attrib.java force an operating system
> precondition?
> 
>     protected boolean isValidOs() {
>         return Os.isFamily("unix") && super.isValidOs();
>     }
> 
> It is simply not true that the os family must be unix for the task to run.
> "unix" should probably be a default value, but the os parameter should be
> enhanced to allow a list of valid families e.g. "unix, windows" thereby
> allowing chmod to be used under windows and unix based builds.
> 
> Rob
> 
> 
> 
> 
>>-----Original Message-----
>>From: Jesse Stockall [mailto:jesse@cryptocard.com]
>>Sent: Friday, January 25, 2002 2:13 PM
>>To: ant-dev
>>Subject: [SUBMIT] Attrib task (chmod for Windows)
>>
>>
>>Hi
>>
>>Here is a a new Task for changing file attributes on Windows. It is
>>based on the Chmod task.
>>
>>
>>
>>
>>--
>> Jesse Stockall			|	Tel: 1+
>>613.599.2441 ext. 243
>> CRYPTOCard Corporation		|	Fax: 1+ 613.599.2442
>> Suite 304, 300 March Rd.	|	email: jesse@cryptocard.com
>> Ottawa, ON, Canada K2K 2E2	|	web: www.cryptocard.com
>>---------------------------------------------------------------------

-- 
fix, n., v.  What one does when a problem has been reported too many
times to be ignored.
   --The New Hacker's Dictionary, 3rd ed.


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message