ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alejandro Abdelnur <alejandro.abdel...@sun.com>
Subject Re: Ant and FileSystem
Date Tue, 04 Sep 2001 19:44:37 GMT

i've run into a similar problem in the ant's antfile, the problem appears to be a bug in the
java.io.File.isAbsolute() method in the windows platform.

in my case i've modified the Ant task to use the following piece of code.

i've just looked how Project.setBasedir works and it uses the FileUtils.normalize() method.

i think the place to add this workaround is the FileUtils.normalize() method, then the ant.setAntfile()
method should be retrofitted to use the normalized
(similarly any other attribute that expects a file name).

hope this helps.

a

-------------------------------------------------------------
   private File getAntFile(String fileName) {
        File file = new File(fileName);
        if (file.exists() && file.isFile()) {
            if (!file.isAbsolute()) {
                // i have to do this because a bug in the JDK (1.2) java.io.File.isAbsolute()
method in Windows platforms.
                boolean doIt = true;
                boolean winOS = (System.getProperty("os.name").indexOf("indows")>0);
                if (winOS) {
                    doIt = !(antFile.startsWith("\\") || antFile.startsWith("/"));
                }
                if (doIt) {
                    antFile = (new File(dir, antFile)).getAbsolutePath();
                    file = (new File(antFile)) ;
                }
            }
        }
        else {
            file = null;
        }
        return file;
    }
-------------------------------------------------------------

Edson Alves Pereira wrote:

> I´ve just using Ant1.3 to deploy in my root directory under WindowsNT like:
> d:\usr\local\htdocs-ssl with this project tag.
>
> <project name="Pannet" default="dist" basedir="/usr/local/htdocs-ssl>
>  ...
> </project>
>
>   But with run the build.xml Ant create this tree in the directory where i´m it´s a
error? If a change the tag to:
>
> <project name="Pannet" default="dist" basedir="d:/usr/local/htdocs-ssl>
>  ...
> </project>
>
>   Everything looks fine.
>
>   With best wishes,
>   Edson Alves Pereira
>
> --
> ////////////////////////////////////////
> Well done is better than well said
> ////////////////////////////////////////
>
> __________________________________________________________________
> Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience
of buying online with Shop@Netscape! http://shopnow.netscape.com/
>
> Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


Mime
View raw message