1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 20:45:22 +02:00

[187096] Ignore "." and ".." folders when copy+paste

This commit is contained in:
Javier Montalvo Orus 2007-10-30 10:06:53 +00:00
parent 2d68c749ff
commit 0e0573305d

View file

@ -1060,6 +1060,10 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
private boolean internalDelete(FTPClient ftpClient, String parentPath, String fileName, boolean isFile, IProgressMonitor monitor) throws RemoteFileIOException, IOException private boolean internalDelete(FTPClient ftpClient, String parentPath, String fileName, boolean isFile, IProgressMonitor monitor) throws RemoteFileIOException, IOException
{ {
if(monitor.isCanceled())
{
throw new RemoteFileCancelledException();
}
clearCache(parentPath); clearCache(parentPath);
boolean hasSucceeded = FTPReply.isPositiveCompletion(ftpClient.cwd(parentPath)); boolean hasSucceeded = FTPReply.isPositiveCompletion(ftpClient.cwd(parentPath));
@ -1089,6 +1093,9 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
FTPFile[] fileNames = ftpClient.listFiles(); FTPFile[] fileNames = ftpClient.listFiles();
for (int i = 0; i < fileNames.length; i++) { for (int i = 0; i < fileNames.length; i++) {
if(fileNames[i].getName().equals(".") || fileNames[i].getName().equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
continue;
}
hasSucceeded = internalDelete(ftpClient,newParentPath,fileNames[i].getName(),fileNames[i].isFile(),monitor); hasSucceeded = internalDelete(ftpClient,newParentPath,fileNames[i].getName(),fileNames[i].isFile(),monitor);
if(!hasSucceeded) if(!hasSucceeded)
{ {
@ -1294,6 +1301,11 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
private boolean internalCopy(FTPClient ftpClient, String srcParent, String srcName, String tgtParent, String tgtName, boolean isDirectory, MyProgressMonitor monitor) throws SystemMessageException, IOException private boolean internalCopy(FTPClient ftpClient, String srcParent, String srcName, String tgtParent, String tgtName, boolean isDirectory, MyProgressMonitor monitor) throws SystemMessageException, IOException
{ {
if(monitor.fMonitor.isCanceled())
{
throw new RemoteFileCancelledException();
}
boolean success = false; boolean success = false;
if(isDirectory) if(isDirectory)
@ -1310,6 +1322,9 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
FTPFile[] fileNames = ftpClient.listFiles(); FTPFile[] fileNames = ftpClient.listFiles();
for (int i = 0; i < fileNames.length; i++) { for (int i = 0; i < fileNames.length; i++) {
if(fileNames[i].getName().equals(".") || fileNames[i].getName().equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
continue;
}
success = internalCopy(ftpClient,newSrcParentPath,fileNames[i].getName(), newTgtParentPath, fileNames[i].getName(), fileNames[i].isDirectory(),monitor); success = internalCopy(ftpClient,newSrcParentPath,fileNames[i].getName(), newTgtParentPath, fileNames[i].getName(), fileNames[i].isDirectory(),monitor);
} }