Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 19667 invoked from network); 3 Mar 2005 15:47:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 3 Mar 2005 15:47:50 -0000 Received: (qmail 13989 invoked by uid 500); 3 Mar 2005 15:47:28 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 13903 invoked by uid 500); 3 Mar 2005 15:47:27 -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 13735 invoked by uid 99); 3 Mar 2005 15:47:27 -0000 X-ASF-Spam-Status: No, hits=1.7 required=10.0 tests=MSGID_RANDY X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from smtp-send.myrealbox.com (HELO smtp-send.myrealbox.com) (192.108.102.143) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 03 Mar 2005 07:47:25 -0800 Received: from toshi2 msorens [63.224.221.33] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.4 $ on Linux; Thu, 03 Mar 2005 08:47:23 -0700 To: "Ant Users List" Subject: Re: fixing crlf without changing timestamp References: <20050304.003558.08224693.yyamano@kt.rim.or.jp> Message-ID: Date: Thu, 03 Mar 2005 07:47:24 -0800 From: "michael sorens" Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <20050304.003558.08224693.yyamano@kt.rim.or.jp> User-Agent: Opera M2/7.54u1 (Win32, build 3918) X-Antivirus: avast! (VPS 0509-4, 03/03/2005), Outbound message X-Antivirus-Status: Clean X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I'm not familiar with applying ant patches, plus I don't have a strong need for the fixcrlf right now, so I'm going to have to postpone any trials for the time being... On Fri, 04 Mar 2005 00:35:58 +0900 (JST), Yuji Yamano wrote: > "michael sorens" writes: > >> Is it possible to run without changing a file's >> modification time? Or perhaps a way to use to restore the >> original modification time after the (on a group of >> files)? I actually want to run fixcrlf in conjunction with copy >> (which has the preservelastmodified attribute to retain the >> modification time) but I see no way to do this. > > The fixcrlf task doesn't support it yet. Could you try this patch? > > Index: FixCRLF.java > =================================================================== > RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v > retrieving revision 1.64 > diff -u -u -r1.64 FixCRLF.java > --- FixCRLF.java 25 Feb 2005 00:33:00 -0000 1.64 > +++ FixCRLF.java 3 Mar 2005 15:30:19 -0000 > @@ -118,6 +118,7 @@ > private int tabs; > private boolean javafiles = false; > private boolean fixlast = true; > + private boolean preserveLastModified = false; > private File srcDir; > private File destDir = null; > @@ -319,6 +320,13 @@ > } > /** > + * Set to true if keeping the last modified time as the original files. > + */ > + public void setPreserveLastModified(boolean preserve) { > + preserveLastModified = preserve; > + } > + > + /** > * Executes the task. > */ > public void execute() throws BuildException { > @@ -381,6 +389,7 @@ > private void processFile(String file) throws BuildException { > File srcFile = new File(srcDir, file); > + long lastModified = srcFile.lastModified(); > File destD = destDir == null ? srcDir : destDir; > File tmpFile = null; > BufferedWriter outWriter; > @@ -557,6 +566,10 @@ > if (destIsWrong) { > FILE_UTILS.rename(tmpFile, destFile); > + if (preserveLastModified) { > + log("preserved lastModified", Project.MSG_DEBUG); > + FILE_UTILS.setFileLastModified(destFile, lastModified); > + } > tmpFile = null; > } > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org