Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 98514 invoked from network); 29 Sep 2004 12:08:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 29 Sep 2004 12:08:35 -0000 Received: (qmail 58843 invoked by uid 500); 29 Sep 2004 12:08:20 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 58782 invoked by uid 500); 29 Sep 2004 12:08:20 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 58766 invoked by uid 99); 29 Sep 2004 12:08:20 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [193.180.251.49] (HELO albatross.ericsson.se) (193.180.251.49) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 29 Sep 2004 05:08:19 -0700 Received: from esealmw141.al.sw.ericsson.se ([153.88.254.120]) by albatross.ericsson.se (8.12.10/8.12.10/WIREfire-1.8b) with ESMTP id i8TC8GWR020052 for ; Wed, 29 Sep 2004 14:08:16 +0200 (MEST) Received: from esealnt610.al.sw.ericsson.se ([153.88.254.120]) by esealmw141.al.sw.ericsson.se with Microsoft SMTPSVC(6.0.3790.0); Wed, 29 Sep 2004 14:08:16 +0200 Received: by esealnt610.al.sw.ericsson.se with Internet Mail Service (5.5.2657.72) id ; Wed, 29 Sep 2004 14:08:16 +0200 Message-ID: <8485E4A514AFE841BA17B2D9C625BC3418154D@esealmw111> From: =?iso-8859-1?Q?Lennart_Hellstr=F6m_=28HF/EBC=29?= To: "'Ant Users List'" Subject: RE: Reading file attributes Date: Wed, 29 Sep 2004 14:08:09 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 29 Sep 2004 12:08:16.0934 (UTC) FILETIME=[00B4FC60:01C4A61D] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Oh, never mind, I solved my error by using the tags BUT, I'm still having problems creating the logic that I want, so = please help me anywone! What I want to do is to copy the file x.txt and y.txt to xprev.txt and = yprev.txt ONLY if xprev.txt and yprev.txt are write enabled.=20 How can I do that? Regards / Lelle >=20 > =20 > > On Sep 28, 2004, at 5:04 AM, Lennart Hellstr=F6m (HF/EBC) wrote: > > > I want to copy a file to a destination file only if the=20 > destination=20 > > > file is not readonly (it might be checked in on the=20 > version control > > > system) > > > > > > I tried using with failOnError=3D"false" but strangely > > the build > > > fails anyway when the destination file is readonly. > > > > > > Is there some way to look at the file's attributes before > > deciding to > > > copy or not? > > > seems to only change the file attributes, and > > that's not what > > > I want. > >=20 > > There may be other ways to do this, but as an example of writing a > > custom selector I do this: > >=20 > > > classname=3D"ReadOnlySelector" > > classpath=3D"build/classes" > > /> > >=20 > > > > > > > > > > > >=20 > > Where ReadOnlySelector is this: > >=20 > > import org.apache.tools.ant.types.selectors.FileSelector; > > import org.apache.tools.ant.BuildException; > >=20 > > import java.io.File; > >=20 > > public class ReadOnlySelector implements FileSelector { > > public boolean isSelected(File basedir, > > String filename, > > File file) throws BuildException { > > return !file.canWrite() && file.canRead(); > > } > > } > >=20 >=20 > Fine, thanks! > With that implemented I now get the following error in my ant=20 > script: "The data type doesn't support the nested=20 > "readonly" element. at line 296" >=20 > Is there something else I need to do to make ant accept my=20 > custom selection? >=20 > / Lelle >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org