DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24296>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24296

"import" fails to find absolute files without drive specifier (windows only)

           Summary: "import" fails to find absolute files without drive
                    specifier (windows only)
           Product: Ant
           Version: 1.6Beta
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The new import task, though excellent in almost every other respect ;-),
fails to find "absolute" files whose paths lack a leading drive specifier.
For example:

C:\temp>cat import-bug.xml
<project name="import-bug">
  <!-- This "import" succeeds; path starts with "c:" -->
  <import file="c:/temp/import.xml"/>
  <!-- This "import" fails; path lacks drive specifier -->
  <import file="/temp/import.xml"/>
</project>

C:\temp>cat import.xml
<project name="import">
  <echo message="import"/>
</project>

C:\temp>ant -f import-bug.xml
Buildfile: import-bug.xml
     [echo] import

BUILD FAILED
C:\temp\import-bug.xml:5: Cannot find /temp/import.xml imported from 
C:\temp\import-bug.xml

Total time: 0 seconds
C:\temp>ant -version
Apache Ant version 1.6beta2 compiled on October 16 2003
C:\temp>

The problem stems from the use of "File.isAbsolute()" in ImportTask.java.
On Windows platforms, "isAbsolute()" considers path names beginning with a
leading slash to be relative paths.  So you would need to check for a
leading "/" or "\" in the import file's path.  I hacked up my local
version of Ant with this fix and it seemed to do the trick.

Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to