ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r594009 - /ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/TempFile.java
Date Mon, 12 Nov 2007 02:40:41 GMT
Author: kevj
Date: Sun Nov 11 18:40:40 2007
New Revision: 594009

URL: http://svn.apache.org/viewvc?rev=594009&view=rev
Log:
-backport/merge FileUtils.createTempFile changes as required

Modified:
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/TempFile.java

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/TempFile.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/TempFile.java?rev=594009&r1=594008&r2=594009&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/TempFile.java (original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/TempFile.java Sun
Nov 11 18:40:40 2007
@@ -65,6 +65,9 @@
 
     /** deleteOnExit flag */
     private boolean deleteOnExit;
+    
+    /** createFile flag */
+    private boolean createFile;
 
     /**
      * Sets the property you wish to assign the temporary file to.
@@ -123,6 +126,22 @@
     public boolean isDeleteOnExit() {
         return deleteOnExit;
     }
+    
+    /**
+     * If set the file is actually created, if not just a name is created.
+     * @param createFile boolean flag.
+     */
+    public void setCreateFile(boolean createFile) {
+        this.createFile = deleteOnExit;
+    }
+
+    /**
+     * Learn whether createFile flag is set for this tempfile task.
+     * @return the createFile flag.
+     */
+    public boolean isCreateFile() {
+        return createFile;
+    }
 
     /**
      * Creates the temporary file.
@@ -136,8 +155,14 @@
         if (destDir == null) {
             destDir = getProject().resolveFile(".");
         }
-        File tfile = FILE_UTILS.createTempFile(
-                prefix, suffix, destDir, deleteOnExit);
+        File tfile;
+        if (createFile) {
+            tfile = FILE_UTILS.createTempFile(prefix, suffix, destDir,
+                    deleteOnExit);
+        } else {
+            tfile = FILE_UTILS.createTempFileName(prefix, suffix, destDir,
+                    deleteOnExit);
+        }
 
         getProject().setNewProperty(property, tfile.toString());
     }



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


Mime
View raw message