(Comment re-used from jglick) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277179 13f79535-47bb-0310-9956-ffa450edef68master
@@ -330,8 +330,7 @@ public class Available extends Task implements Condition { | |||||
return false; | return false; | ||||
} | } | ||||
FileUtils fileUtils = FileUtils.newFileUtils(); | |||||
File parent = fileUtils.getParentFile(path); | |||||
File parent = path.getParentFile(); | |||||
// ** full-pathname specified == parent dir of path in list | // ** full-pathname specified == parent dir of path in list | ||||
if (parent != null && parent.exists() | if (parent != null && parent.exists() | ||||
&& file.equals(parent.getAbsolutePath())) { | && file.equals(parent.getAbsolutePath())) { | ||||
@@ -364,7 +363,7 @@ public class Available extends Task implements Condition { | |||||
// ** simple name specified == parent of parent dir + name | // ** simple name specified == parent of parent dir + name | ||||
if (parent != null) { | if (parent != null) { | ||||
File grandParent = fileUtils.getParentFile(parent); | |||||
File grandParent = parent.getParentFile(); | |||||
if (grandParent != null && grandParent.exists()) { | if (grandParent != null && grandParent.exists()) { | ||||
if (checkFile(new File(grandParent, file), | if (checkFile(new File(grandParent, file), | ||||
file + " in " + grandParent)) { | file + " in " + grandParent)) { | ||||
@@ -561,7 +561,7 @@ public class Concat extends Task { | |||||
os = new LogOutputStream(this, Project.MSG_WARN); | os = new LogOutputStream(this, Project.MSG_WARN); | ||||
} else { | } else { | ||||
// ensure that the parent dir of dest file exists | // ensure that the parent dir of dest file exists | ||||
File parent = fileUtils.getParentFile(destinationFile); | |||||
File parent = destinationFile.getParentFile(); | |||||
if (!parent.exists()) { | if (!parent.exists()) { | ||||
parent.mkdirs(); | parent.mkdirs(); | ||||
} | } | ||||
@@ -509,7 +509,7 @@ public class Copy extends Task { | |||||
} | } | ||||
if (destFile != null) { | if (destFile != null) { | ||||
destDir = fileUtils.getParentFile(destFile); | |||||
destDir = destFile.getParentFile(); | |||||
} | } | ||||
} | } | ||||
@@ -241,7 +241,7 @@ public class Expand extends Task { | |||||
log("expanding " + entryName + " to " + f, | log("expanding " + entryName + " to " + f, | ||||
Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
// create intermediary directories - sometimes zip don't add them | // create intermediary directories - sometimes zip don't add them | ||||
File dirF = fileUtils.getParentFile(f); | |||||
File dirF = f.getParentFile(); | |||||
if (dirF != null) { | if (dirF != null) { | ||||
dirF.mkdirs(); | dirF.mkdirs(); | ||||
} | } | ||||
@@ -1000,3 +1000,4 @@ public class FixCRLF extends MatchingTask { | |||||
} | } | ||||
} | } | ||||
@@ -74,7 +74,7 @@ public class Move extends Copy { | |||||
destFile = (destFile == null) | destFile = (destFile == null) | ||||
? new File(destDir, file.getName()) : destFile; | ? new File(destDir, file.getName()) : destFile; | ||||
destDir = (destDir == null) | destDir = (destDir == null) | ||||
? fileUtils.getParentFile(destFile) : destDir; | |||||
? destFile.getParentFile() : destDir; | |||||
completeDirMap.put(file, destFile); | completeDirMap.put(file, destFile); | ||||
file = null; | file = null; | ||||
@@ -562,7 +562,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
*/ | */ | ||||
private void ensureDirectoryFor(File targetFile) | private void ensureDirectoryFor(File targetFile) | ||||
throws BuildException { | throws BuildException { | ||||
File directory = fileUtils.getParentFile(targetFile); | |||||
File directory = targetFile.getParentFile(); | |||||
if (!directory.exists()) { | if (!directory.exists()) { | ||||
if (!directory.mkdirs()) { | if (!directory.mkdirs()) { | ||||
throw new BuildException("Unable to create directory: " | throw new BuildException("Unable to create directory: " | ||||
@@ -407,7 +407,7 @@ public class Zip extends MatchingTask { | |||||
if (doUpdate) { | if (doUpdate) { | ||||
renamedFile = | renamedFile = | ||||
fileUtils.createTempFile("zip", ".tmp", | fileUtils.createTempFile("zip", ".tmp", | ||||
fileUtils.getParentFile(zipFile)); | |||||
zipFile.getParentFile()); | |||||
renamedFile.deleteOnExit(); | renamedFile.deleteOnExit(); | ||||
try { | try { | ||||
@@ -1310,7 +1310,7 @@ public class FTP | |||||
try { | try { | ||||
if (action == LIST_FILES) { | if (action == LIST_FILES) { | ||||
File pd = fileUtils.getParentFile(listing); | |||||
File pd = listing.getParentFile(); | |||||
if (!pd.exists()) { | if (!pd.exists()) { | ||||
pd.mkdirs(); | pd.mkdirs(); | ||||
@@ -1782,7 +1782,7 @@ public class FTP | |||||
+ file.getAbsolutePath()); | + file.getAbsolutePath()); | ||||
} | } | ||||
File pdir = fileUtils.getParentFile(file); | |||||
File pdir = file.getParentFile(); | |||||
if (!pdir.exists()) { | if (!pdir.exists()) { | ||||
pdir.mkdirs(); | pdir.mkdirs(); | ||||
@@ -507,7 +507,7 @@ public class FileUtils { | |||||
// ensure that parent dir of dest file exists! | // ensure that parent dir of dest file exists! | ||||
// not using getParentFile method to stay 1.1 compat | // not using getParentFile method to stay 1.1 compat | ||||
File parent = getParentFile(destFile); | |||||
File parent = destFile.getParentFile(); | |||||
if (parent != null && !parent.exists()) { | if (parent != null && !parent.exists()) { | ||||
parent.mkdirs(); | parent.mkdirs(); | ||||
} | } | ||||
@@ -709,7 +709,7 @@ public class FileUtils { | |||||
while (tok.hasMoreTokens()) { | while (tok.hasMoreTokens()) { | ||||
String part = tok.nextToken(); | String part = tok.nextToken(); | ||||
if (part.equals("..")) { | if (part.equals("..")) { | ||||
helpFile = getParentFile(helpFile); | |||||
helpFile = helpFile.getParentFile(); | |||||
if (helpFile == null) { | if (helpFile == null) { | ||||
String msg = "The file or path you specified (" | String msg = "The file or path you specified (" | ||||
+ filename + ") is invalid relative to " | + filename + ") is invalid relative to " | ||||
@@ -1260,7 +1260,7 @@ public class FileUtils { | |||||
throw new IOException("Failed to delete " + to | throw new IOException("Failed to delete " + to | ||||
+ " while trying to rename " + from); | + " while trying to rename " + from); | ||||
} | } | ||||
File parent = getParentFile(to); | |||||
File parent = to.getParentFile(); | |||||
if (parent != null && !parent.exists() && !parent.mkdirs()) { | if (parent != null && !parent.exists() && !parent.mkdirs()) { | ||||
throw new IOException("Failed to create directory " + parent | throw new IOException("Failed to create directory " + parent | ||||
+ " while trying to rename " + from); | + " while trying to rename " + from); | ||||
@@ -123,7 +123,7 @@ public class XmlPropertyTest extends BuildFileTest { | |||||
// folder of the input file. Otherwise, its the "current" dir.. | // folder of the input file. Otherwise, its the "current" dir.. | ||||
File workingDir; | File workingDir; | ||||
if ( localRoot ) { | if ( localRoot ) { | ||||
workingDir = fileUtils.getParentFile(inputFile); | |||||
workingDir = inputFile.getParentFile(); | |||||
} else { | } else { | ||||
workingDir = fileUtils.resolveFile(new File("."), "."); | workingDir = fileUtils.resolveFile(new File("."), "."); | ||||
} | } | ||||
@@ -285,7 +285,7 @@ public class XmlPropertyTest extends BuildFileTest { | |||||
+ ".properties"; | + ".properties"; | ||||
} | } | ||||
File dir = fileUtils.getParentFile(fileUtils.getParentFile(input)); | |||||
File dir = input.getParentFile().getParentFile(); | |||||
String goldFileFolder = "goldfiles/"; | String goldFileFolder = "goldfiles/"; | ||||