ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Niven" <jni...@advoco-consulting.com>
Subject RE: Changing files attributes
Date Thu, 21 Nov 2002 12:29:22 GMT
> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org] 
> Sent: 21 November 2002 07:51
> To: ant-user@jakarta.apache.org
> Subject: Re: Changing files attributes
> 
> 
> On Thu, 21 Nov 2002, Janusz Dalecki <jdalecki@tycoint.com> wrote:
> 
> > I need to change the attributes of the files that are 
> copied after the 
> > ant build is done.
> 
> Ant 1.6 will have an <attrib> task.

In the meantime, and for earlier Ant versions, I've been using <exec>
with the Windows "attrib" program to mimic "chmod":

	<target	name="get.db"	depends="do.get"	if="db.path">
		<!-- make the database(s) read-write: -->
		<exec	dir="${db.path}"
				executable="attrib.exe">
			<arg	value="-R"/>
		</exec>
		<echo>
(database(s) in directory: ${db.path} is/are now writable)
		</echo>
	</target>

This should be self-explanatory - the crucial part is the <exec> task.
The "-R" argument instructs attrib to make everything in the ${db.path}
directory writable (-R == NOT read-only).

> 
> I think the task itself should work with Ant 1.5.1 as well, 
> so you can download the source from 
<http://cvs.apache.org/viewcvs.cgi/jakarta-ant/src/main/org/apache/tools
/ant/taskdefs/optional/windows/Attrib.java>
> compile and <taskdef> it.
>
> Documentation of the task itself is here
<http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-ant/docs/manual/Op
tionalTasks/attrib.html?rev=HEAD&content-type=text/html>
>
> Stefan

Got to admit though, a dedicated task that worked on Windows and *nix
would be a much nicer solution.

HTH,
John

--
John Niven
Please reply via newsgroup/mailing-list. 

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


Mime
View raw message