mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[235472] [ssh] Fix Properties of the file system root
This commit is contained in:
parent
16ec36d533
commit
55018268b0
2 changed files with 21 additions and 4 deletions
|
@ -32,6 +32,7 @@
|
|||
* Martin Oberhuber (Wind River) - [233651] Make ssh delete throw proper exceptions
|
||||
* Martin Oberhuber (Wind River) - [235477][ssh] SftpFileService.createFolder() fails for file named "a?*"
|
||||
* Martin Oberhuber (Wind River) - [235360][ftp][ssh][local] Return proper "Root" IHostFile
|
||||
* David McKnight (IBM) - [235472] [ssh] RSE doesn't show correct properties of the file system root ("/")
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.services.ssh.files;
|
||||
|
@ -89,7 +90,6 @@ import org.eclipse.rse.services.files.IHostFilePermissions;
|
|||
import org.eclipse.rse.services.files.IHostFilePermissionsContainer;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
|
||||
public class SftpFileService extends AbstractFileService implements ISshService, IFilePermissionsService
|
||||
{
|
||||
|
||||
|
@ -489,7 +489,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
}
|
||||
if (node==null) {
|
||||
boolean isRoot = (remoteParent == null || remoteParent.length() == 0);
|
||||
node = new SftpHostFile(remoteParent, fileName, false, isRoot, false, 0, 0);
|
||||
node = new SftpHostFile(isRoot ? null : remoteParent, fileName, false, isRoot, false, 0, 0);
|
||||
node.setExists(false);
|
||||
}
|
||||
return node;
|
||||
|
@ -622,7 +622,7 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
}
|
||||
}
|
||||
|
||||
SftpHostFile node = new SftpHostFile(parentPath, fileName, attrsTarget.isDir(), isRoot, attrs.isLink(), 1000L * attrs.getMTime(), attrs.getSize());
|
||||
SftpHostFile node = new SftpHostFile(isRoot ? null : parentPath, fileName, attrsTarget.isDir(), isRoot, attrs.isLink(), 1000L * attrs.getMTime(), attrs.getSize());
|
||||
if (linkTarget!=null) {
|
||||
node.setLinkTarget(linkTarget);
|
||||
}
|
||||
|
@ -862,7 +862,15 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
|||
}
|
||||
|
||||
public IHostFile[] getRoots(IProgressMonitor monitor) {
|
||||
IHostFile root = new SftpHostFile(null, "/", true, true, false, 0, 0); //$NON-NLS-1$
|
||||
IHostFile root = null;
|
||||
try {
|
||||
root = getFile(null, "/", monitor);
|
||||
}
|
||||
catch (SystemMessageException e){
|
||||
}
|
||||
if (root == null){
|
||||
root = new SftpHostFile(null, "/", true, true, false, 0, 0); //$NON-NLS-1$
|
||||
}
|
||||
return new IHostFile[] { root };
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* Martin Oberhuber (Wind River) - Adapted from FTPHostFile.
|
||||
* David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
|
||||
* Martin Oberhuber (Wind River) - [235360][ftp][ssh][local] Return proper "Root" IHostFile
|
||||
* Martin Oberhuber (Wind River) - [235472] [ssh] RSE doesn't show correct properties of the file system root ("/")
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.services.ssh.files;
|
||||
|
@ -52,6 +53,14 @@ public class SftpHostFile implements IHostFile, IHostFilePermissionsContainer {
|
|||
fName = name;
|
||||
if (name == null || name.length() == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
} else if (parentPath == null || isRoot) {
|
||||
//Root files must be consistent
|
||||
if (parentPath !=null || !isRoot /* || !isDirectory */) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
} else if (name.indexOf('/')>=0) {
|
||||
//Non-root files must not have a relative path as name, or it would break parent/child relationships
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
fIsDirectory = isDirectory;
|
||||
fIsRoot = isRoot;
|
||||
|
|
Loading…
Add table
Reference in a new issue