@@ -194,7 +194,8 @@ public class FTP
try {
try {
String cwd = ftp.printWorkingDirectory();
String cwd = ftp.printWorkingDirectory();
// always start from the current ftp working dir
// always start from the current ftp working dir
forceRemoteSensitivityCheck();
checkIncludePatterns();
checkIncludePatterns();
clearCaches();
clearCaches();
ftp.changeWorkingDirectory(cwd);
ftp.changeWorkingDirectory(cwd);
@@ -210,6 +211,7 @@ public class FTP
* @since ant1.6
* @since ant1.6
*/
*/
private void checkIncludePatterns() {
private void checkIncludePatterns() {
Hashtable newroots = new Hashtable();
Hashtable newroots = new Hashtable();
// put in the newroots vector the include patterns without
// put in the newroots vector the include patterns without
// wildcard tokens
// wildcard tokens
@@ -246,6 +248,7 @@ public class FTP
String path = null;
String path = null;
if (myfile.exists()) {
if (myfile.exists()) {
forceRemoteSensitivityCheck();
if (remoteSensitivityChecked
if (remoteSensitivityChecked
&& remoteSystemCaseSensitive && isFollowSymlinks()) {
&& remoteSystemCaseSensitive && isFollowSymlinks()) {
// cool case,
// cool case,
@@ -262,7 +265,6 @@ public class FTP
throw new BuildException(be, getLocation());
throw new BuildException(be, getLocation());
} catch (BuildException be) {
} catch (BuildException be) {
isOK = false;
isOK = false;
}
}
}
}
} else {
} else {
@@ -509,6 +511,17 @@ public class FTP
}
}
return result;
return result;
}
}
private void forceRemoteSensitivityCheck()
{
if (!remoteSensitivityChecked) {
try {
checkRemoteSensitivity(ftp.listFiles(), ftp.printWorkingDirectory());
} catch (IOException ioe) {
throw new BuildException(ioe, getLocation());
}
}
}
/**
/**
* cd into one directory and
* cd into one directory and
* list the files present in one directory.
* list the files present in one directory.
@@ -763,14 +776,16 @@ public class FTP
if (theFiles != null) {
if (theFiles != null) {
theFile = getFile(theFiles, currentElement);
theFile = getFile(theFiles, currentElement);
}
}
if (!relPath.equals("")) {
relPath = relPath + remoteFileSep;
}
if (theFile == null) {
if (theFile == null) {
throw new BuildException("could not find " + currentElement
+ " from " + currentPath);
// hit a hidden file assume not a symlink
relPath = relPath + currentElement;
currentPath = currentPath + remoteFileSep + currentElement;
log("Hidden file " + relPath + " assumed to not be a symlink.", Project.MSG_VERBOSE);
} else {
} else {
traversesSymlinks = traversesSymlinks || theFile.isSymbolicLink();
traversesSymlinks = traversesSymlinks || theFile.isSymbolicLink();
if (!relPath.equals("")) {
relPath = relPath + remoteFileSep;
}
relPath = relPath + theFile.getName();
relPath = relPath + theFile.getName();
currentPath = currentPath + remoteFileSep + theFile.getName();
currentPath = currentPath + remoteFileSep + theFile.getName();
}
}
@@ -854,6 +869,10 @@ public class FTP
}
}
return traversesSymlinks;
return traversesSymlinks;
}
}
public String toString() {
return "AntFtpFile: "+curpwd+"%"+ftpFile;
}
}
}
/**
/**
* special class to represent the remote directory itself
* special class to represent the remote directory itself
@@ -1273,7 +1292,6 @@ public class FTP
protected int transferFiles(FTPClient ftp, FileSet fs)
protected int transferFiles(FTPClient ftp, FileSet fs)
throws IOException, BuildException {
throws IOException, BuildException {
DirectoryScanner ds;
DirectoryScanner ds;
if (action == SEND_FILES) {
if (action == SEND_FILES) {
ds = fs.getDirectoryScanner(getProject());
ds = fs.getDirectoryScanner(getProject());
} else {
} else {
@@ -1771,7 +1789,6 @@ public class FTP
protected void getFile(FTPClient ftp, String dir, String filename)
protected void getFile(FTPClient ftp, String dir, String filename)
throws IOException, BuildException {
throws IOException, BuildException {
OutputStream outstream = null;
OutputStream outstream = null;
try {
try {
File file = getProject().resolveFile(new File(dir, filename).getPath());
File file = getProject().resolveFile(new File(dir, filename).getPath());