peterreilly 2003/10/31 07:59:45
Modified: src/main/org/apache/tools/ant/taskdefs ImportTask.java
Log:
Use FileUtils#resolveFile instead of doing it by hand
Should work now on windows and netware
PR: 24296
Obtained from: Matt Lennon
Revision Changes Path
1.18 +3 -6
ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java
Index: ImportTask.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ImportTask.java 16 Oct 2003 17:04:01 -0000 1.17
+++ ImportTask.java 31 Oct 2003 15:59:45 -0000 1.18
@@ -58,6 +58,7 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.Task;
+import org.apache.tools.ant.util.FileUtils;
import java.io.File;
import java.io.IOException;
@@ -95,6 +96,7 @@
public class ImportTask extends Task {
private String file;
private boolean optional;
+ private static final FileUtils FILE_UTILS = FileUtils.newFileUtils();
/**
* sets the optional attribute
@@ -147,17 +149,12 @@
File buildFile = new File(getLocation().getFileName());
buildFile = new File(buildFile.getAbsolutePath());
- File buildFileParent = new File(buildFile.getParent());
-
getProject().log("Importing file " + file + " from "
+ buildFile.getAbsolutePath(), Project.MSG_VERBOSE);
// Paths are relative to the build file they're imported from,
// *not* the current directory (same as entity includes).
- File importedFile = new File(file);
- if (!importedFile.isAbsolute()) {
- importedFile = new File(buildFileParent, file);
- }
+ File importedFile = FILE_UTILS.resolveFile(buildFile, file);
if (!importedFile.exists()) {
String message =
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]