mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
[204669] Fix ftp path concatenation on systems using backslash separator
This commit is contained in:
parent
9cbfce5440
commit
be038e0311
5 changed files with 60 additions and 25 deletions
|
@ -13,6 +13,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
||||||
* Rupen Mardirossian (IBM) - [187530] Commented out line 192, in order to stop logging of SystemMessageException
|
* Rupen Mardirossian (IBM) - [187530] Commented out line 192, in order to stop logging of SystemMessageException
|
||||||
|
* Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.wizards;
|
package org.eclipse.rse.internal.files.ui.wizards;
|
||||||
|
@ -174,7 +175,7 @@ public class SystemNewFileWizard
|
||||||
IRemoteFile newFile = null;
|
IRemoteFile newFile = null;
|
||||||
IProgressMonitor monitor = new NullProgressMonitor();
|
IProgressMonitor monitor = new NullProgressMonitor();
|
||||||
try {
|
try {
|
||||||
IRemoteFile newFilePath = rfss.getRemoteFileObject(absName, monitor);
|
IRemoteFile newFilePath = rfss.getRemoteFileObject(parentFolder, name, monitor);
|
||||||
newFile = rfss.createFile(newFilePath, monitor);
|
newFile = rfss.createFile(newFilePath, monitor);
|
||||||
} catch (RemoteFileIOException exc ) {
|
} catch (RemoteFileIOException exc ) {
|
||||||
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote file "+ absName + " failed with RemoteFileIOException " ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote file "+ absName + " failed with RemoteFileIOException " ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Berger (IBM) - Fixing 140408 - FTP upload does not work
|
* Michael Berger (IBM) - Fixing 140408 - FTP upload does not work
|
||||||
* Javier Montalvo Orús (Symbian) - Migrate to jakarta commons net FTP client
|
* Javier Montalvo Orús (Symbian) - Migrate to jakarta commons net FTP client
|
||||||
* Javier Montalvo Orus (Symbian) - Fixing 161211 - Cannot expand /pub folder as
|
* Javier Montalvo Orus (Symbian) - Fixing 161211 - Cannot expand /pub folder as anonymous on ftp.wacom.com
|
||||||
* anonymous on ftp.wacom.com
|
|
||||||
* Javier Montalvo Orus (Symbian) - Fixing 161238 - [ftp] connections to VMS servers are not usable
|
* Javier Montalvo Orus (Symbian) - Fixing 161238 - [ftp] connections to VMS servers are not usable
|
||||||
* Javier Montalvo Orus (Symbian) - Fixing 176216 - [api] FTP sould provide API to allow clients register their own FTPListingParser
|
* Javier Montalvo Orus (Symbian) - Fixing 176216 - [api] FTP sould provide API to allow clients register their own FTPListingParser
|
||||||
* Javier Montalvo Orus (Symbian) - [197758] Unix symbolic links are not classified as file vs. folder
|
* Javier Montalvo Orus (Symbian) - [197758] Unix symbolic links are not classified as file vs. folder
|
||||||
* Javier Montalvo Orus (Symbian) - [198272] FTP should return classification for symbolic links so they show a link overlay
|
* Javier Montalvo Orus (Symbian) - [198272] FTP should return classification for symbolic links so they show a link overlay
|
||||||
|
* Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.files.ftp;
|
package org.eclipse.rse.internal.services.files.ftp;
|
||||||
|
@ -27,6 +27,7 @@ package org.eclipse.rse.internal.services.files.ftp;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.commons.net.ftp.FTPFile;
|
import org.apache.commons.net.ftp.FTPFile;
|
||||||
|
import org.eclipse.rse.services.clientserver.PathUtility;
|
||||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||||
import org.eclipse.rse.services.files.IHostFile;
|
import org.eclipse.rse.services.files.IHostFile;
|
||||||
|
|
||||||
|
@ -123,15 +124,19 @@ public class FTPHostFile implements IHostFile
|
||||||
if (isRoot() || _parentPath==null) {
|
if (isRoot() || _parentPath==null) {
|
||||||
return getName();
|
return getName();
|
||||||
} else {
|
} else {
|
||||||
StringBuffer path = new StringBuffer(getParentPath());
|
String parentPath = getParentPath();
|
||||||
if (!_parentPath.endsWith("/") && !_parentPath.endsWith("\\"))//$NON-NLS-1$ //$NON-NLS-2$
|
StringBuffer path = new StringBuffer(parentPath);
|
||||||
|
if (!parentPath.endsWith("/") && !parentPath.endsWith("\\"))//$NON-NLS-1$ //$NON-NLS-2$
|
||||||
{
|
{
|
||||||
path.append('/');
|
//TODO IFileService should have a method for this
|
||||||
|
String sep = PathUtility.getSeparator(parentPath);
|
||||||
|
if (!parentPath.endsWith(sep)) {
|
||||||
|
path.append(sep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
path.append(getName());
|
path.append(getName());
|
||||||
return path.toString();
|
return path.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getModifiedDate()
|
public long getModifiedDate()
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary
|
* Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary
|
||||||
* Javier Montalvo Orus (Symbian) - [199243] Renaming a file in an FTP-based EFS folder hangs all of Eclipse
|
* Javier Montalvo Orus (Symbian) - [199243] Renaming a file in an FTP-based EFS folder hangs all of Eclipse
|
||||||
* Martin Oberhuber (Wind River) - [203306] Fix Deadlock comparing two files on FTP
|
* Martin Oberhuber (Wind River) - [203306] Fix Deadlock comparing two files on FTP
|
||||||
|
* Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.files.ftp;
|
package org.eclipse.rse.internal.services.files.ftp;
|
||||||
|
@ -93,6 +94,7 @@ import org.eclipse.rse.services.Mutex;
|
||||||
import org.eclipse.rse.services.clientserver.FileTypeMatcher;
|
import org.eclipse.rse.services.clientserver.FileTypeMatcher;
|
||||||
import org.eclipse.rse.services.clientserver.IMatcher;
|
import org.eclipse.rse.services.clientserver.IMatcher;
|
||||||
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
|
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
|
||||||
|
import org.eclipse.rse.services.clientserver.PathUtility;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||||
import org.eclipse.rse.services.files.AbstractFileService;
|
import org.eclipse.rse.services.files.AbstractFileService;
|
||||||
import org.eclipse.rse.services.files.IFileService;
|
import org.eclipse.rse.services.files.IFileService;
|
||||||
|
@ -135,7 +137,7 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
||||||
private static long FTP_STATCACHE_TIMEOUT = 200; //msec
|
private static long FTP_STATCACHE_TIMEOUT = 200; //msec
|
||||||
|
|
||||||
|
|
||||||
private class FTPBufferedInputStream extends BufferedInputStream {
|
private static class FTPBufferedInputStream extends BufferedInputStream {
|
||||||
|
|
||||||
private FTPClient client;
|
private FTPClient client;
|
||||||
|
|
||||||
|
@ -379,6 +381,8 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
finally {
|
||||||
_ftpClient = null;
|
_ftpClient = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,15 +665,7 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
||||||
|
|
||||||
private char getSeparator()
|
private char getSeparator()
|
||||||
{
|
{
|
||||||
char separator = '/';
|
return PathUtility.getSeparator(_userHome).charAt(0);
|
||||||
|
|
||||||
if(_userHome.indexOf('\\')!=-1 && _userHome.indexOf('/')==-1)
|
|
||||||
{
|
|
||||||
separator = '\\';
|
|
||||||
}
|
|
||||||
|
|
||||||
return separator;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
* Javier Montalvo Orus (Symbian) - [187531] Improve exception thrown when Login Failed on FTP
|
* Javier Montalvo Orus (Symbian) - [187531] Improve exception thrown when Login Failed on FTP
|
||||||
* David Dykstal (IBM) - added RESID_FTP_SETTINGS_LABEL
|
* David Dykstal (IBM) - added RESID_FTP_SETTINGS_LABEL
|
||||||
* David McKnight (IBM) - [196632] [ftp] Passive mode setting does not work
|
* David McKnight (IBM) - [196632] [ftp] Passive mode setting does not work
|
||||||
|
* Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.subsystems.files.ftp.connectorservice;
|
package org.eclipse.rse.internal.subsystems.files.ftp.connectorservice;
|
||||||
|
@ -38,6 +39,7 @@ import org.eclipse.rse.internal.services.files.ftp.FTPService;
|
||||||
import org.eclipse.rse.internal.subsystems.files.ftp.FTPSubsystemResources;
|
import org.eclipse.rse.internal.subsystems.files.ftp.FTPSubsystemResources;
|
||||||
import org.eclipse.rse.internal.subsystems.files.ftp.parser.FTPClientConfigFactory;
|
import org.eclipse.rse.internal.subsystems.files.ftp.parser.FTPClientConfigFactory;
|
||||||
import org.eclipse.rse.services.files.IFileService;
|
import org.eclipse.rse.services.files.IFileService;
|
||||||
|
import org.eclipse.rse.services.files.IHostFile;
|
||||||
import org.eclipse.rse.services.files.RemoteFileException;
|
import org.eclipse.rse.services.files.RemoteFileException;
|
||||||
import org.eclipse.rse.ui.subsystems.StandardConnectorService;
|
import org.eclipse.rse.ui.subsystems.StandardConnectorService;
|
||||||
import org.eclipse.ui.console.ConsolePlugin;
|
import org.eclipse.ui.console.ConsolePlugin;
|
||||||
|
@ -110,6 +112,20 @@ public class FTPConnectorService extends StandardConnectorService
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.core.subsystems.AbstractConnectorService#getHomeDirectory()
|
||||||
|
*/
|
||||||
|
public String getHomeDirectory() {
|
||||||
|
if (_ftpService!=null) {
|
||||||
|
IHostFile f = _ftpService.getUserHome();
|
||||||
|
if (f!=null) {
|
||||||
|
return f.getAbsolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//fallback while not yet connected
|
||||||
|
return super.getHomeDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
private OutputStream getLoggingStream(String hostName,int portNumber)
|
private OutputStream getLoggingStream(String hostName,int portNumber)
|
||||||
{
|
{
|
||||||
MessageConsole messageConsole=null;
|
MessageConsole messageConsole=null;
|
||||||
|
|
|
@ -13,12 +13,14 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Javier Montalvo Orus (Symbian) - [198272] FTP should return classification for symbolic links so they show a link overlay
|
* Javier Montalvo Orus (Symbian) - [198272] FTP should return classification for symbolic links so they show a link overlay
|
||||||
|
* Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.subsystems.files.ftp.model;
|
package org.eclipse.rse.internal.subsystems.files.ftp.model;
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.rse.internal.services.files.ftp.FTPHostFile;
|
import org.eclipse.rse.internal.services.files.ftp.FTPHostFile;
|
||||||
|
import org.eclipse.rse.services.clientserver.PathUtility;
|
||||||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.AbstractRemoteFile;
|
import org.eclipse.rse.subsystems.files.core.servicesubsystem.AbstractRemoteFile;
|
||||||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
|
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
|
@ -51,11 +53,26 @@ public class FTPRemoteFile extends AbstractRemoteFile
|
||||||
return _ftpHostFile.getClassification();
|
return _ftpHostFile.getClassification();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile#getSeparator()
|
||||||
|
*/
|
||||||
|
public String getSeparator() {
|
||||||
|
String absPath = getAbsolutePath();
|
||||||
|
if (absPath!=null && absPath.length()>1) {
|
||||||
|
return PathUtility.getSeparator(absPath);
|
||||||
|
}
|
||||||
|
String home = getParentRemoteFileSubSystem().getConnectorService().getHomeDirectory();
|
||||||
|
if (home!=null && home.length()>1) {
|
||||||
|
return PathUtility.getSeparator(home);
|
||||||
|
}
|
||||||
|
return PathUtility.getSeparator(absPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile#getSeparatorChar()
|
||||||
|
*/
|
||||||
|
public char getSeparatorChar() {
|
||||||
|
return getSeparator().charAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue