ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rich Chang <rch...@eecs.tufts.edu>
Subject Re: temp props file created by <junit> task
Date Fri, 13 Dec 2002 22:05:05 GMT

> The good thing is, that there is a centralized createTempFile methof
> in FileUtils, so if we change it in that place, other tasks like
> <javadoc> or <javac> using jikes or ... would benefit from it as well.
>

In FileUtils, the method sig and javadoc defined are:

    /**
     * Create a temporary file in a given directory.
     *
     * <p>The file denoted by the returned abstract pathname did not
     * exist before this method was invoked, any subsequent invocation
     * of this method will yield a different file name.</p>
     *
     * <p>This method is different to File.createTempFile of JDK 1.2
     * as it doesn't create the file itself and doesn't use platform
     * specific temporary directory when the parentDir attribute is
     * null.</p>
     *
     * @param parentDir Directory to create the temporary file in -
     * current working directory will be assumed if this parameter is
     * null.
     *
     * @since 1.8
     */
  public File createTempFile(String prefix, String suffix, File parentDir)

>From looking at the javadoc, it seems this method was written to
intentionally AVOID using the platform specific temp dir, although it's
not clear to me why. Any ideas? But this utility was probably more
concerned about NOT creating the temp file.

I would like to see an overloaded method that omits the parentDir:
  public File createTempFile(String prefix, String suffix)

which uses the platform temp dir.  If a null parentDir is passed into the
original method, it defers to calling this new overloaded method
-this mirrors what java.io.File does with its createTempFile() methods.

If the temp file in JunitTask is deleted afterwards anyway, I don't think
people will care where it's generated (as long as the dir is writable)
 and so a new "tmpDir" attribute need not be added to the JUnitTask.

Again, I may be missing exactly why the platform temp dir wasn't used in
the first place.
Thoughts?
-Rich



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


Mime
View raw message