Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 13417 invoked from network); 3 Mar 2005 15:36:27 -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:36:27 -0000 Received: (qmail 83577 invoked by uid 500); 3 Mar 2005 15:36:22 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 83482 invoked by uid 500); 3 Mar 2005 15:36:21 -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 83461 invoked by uid 99); 3 Mar 2005 15:36: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 serio.al.rim.or.jp (HELO serio.al.rim.or.jp) (202.247.191.123) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 03 Mar 2005 07:36:19 -0800 Received: from mail4 by serio.al.rim.or.jp (3.7W/HMX-13) id AAA06751; Fri, 4 Mar 2005 00:36:11 +0900 (JST) Received: from localhost (ppp011.pas.jp.rim.or.jp [202.247.176.43]) by mail4 (8.9.3/3.7W) id AAA17250; Fri, 4 Mar 2005 00:35:02 +0900 (JST) Date: Fri, 04 Mar 2005 00:35:58 +0900 (JST) Message-Id: <20050304.003558.08224693.yyamano@kt.rim.or.jp> To: user@ant.apache.org, msorens@softhome.net Subject: Re: fixing crlf without changing timestamp From: Yuji Yamano In-Reply-To: References: X-Mailer: Mew version 3.1.53 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N "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; } -- Yuji Yamano --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org