mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-20 06:35:50 +02:00
[331249] fixed getting home dir.
This commit is contained in:
parent
c00443f22e
commit
6ede0e4e0b
1 changed files with 5 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2010 Mentor Graphics Corporation and others.
|
* Copyright (c) 2009, 2011 Mentor Graphics Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Nikita Shulga - initial API and implementation
|
* Nikita Shulga - initial API and implementation
|
||||||
* Anna Dushistova (Mentor Graphics) - [331213][scp] Provide UI-less scp IFileService in org.eclipse.rse.services.ssh
|
* Anna Dushistova (Mentor Graphics) - [331213][scp] Provide UI-less scp IFileService in org.eclipse.rse.services.ssh
|
||||||
|
* Anna Dushistova (Mentor Graphics) - [331249][scp] incorrect home while logging in as root
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.services.ssh.files.scp;
|
package org.eclipse.rse.internal.services.ssh.files.scp;
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ public class ScpFileService extends AbstractFileService implements
|
||||||
if (lsStrings[i].length() == 0 || lsStrings[i].startsWith("total")) //$NON-NLS-1$
|
if (lsStrings[i].length() == 0 || lsStrings[i].startsWith("total")) //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
ScpFileAttr attr = new ScpFileAttr(lsStrings[i]);
|
ScpFileAttr attr = new ScpFileAttr(lsStrings[i]);
|
||||||
if (attr == null || attr.getName() == null) {
|
if (attr.getName() == null) {
|
||||||
Activator.warn("internalFetch(parentPath='" + parentPath
|
Activator.warn("internalFetch(parentPath='" + parentPath
|
||||||
+ "'): Can't get name of " + lsStrings[i], null);
|
+ "'): Can't get name of " + lsStrings[i], null);
|
||||||
continue;
|
continue;
|
||||||
|
@ -259,7 +260,7 @@ public class ScpFileService extends AbstractFileService implements
|
||||||
if (fUserHome == null) {
|
if (fUserHome == null) {
|
||||||
try {
|
try {
|
||||||
Session sess = getSession();
|
Session sess = getSession();
|
||||||
fUserHome = ScpFileUtils.execCommand(sess, "pwd").split( //$NON-NLS-1$
|
fUserHome = ScpFileUtils.execCommand(sess, "cd ;pwd").split( //$NON-NLS-1$
|
||||||
ScpFileUtils.EOL_STRING)[0];
|
ScpFileUtils.EOL_STRING)[0];
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Activator.warn("Failed to execute pwd", e);
|
Activator.warn("Failed to execute pwd", e);
|
||||||
|
@ -271,7 +272,7 @@ public class ScpFileService extends AbstractFileService implements
|
||||||
int lastSlash = fUserHome
|
int lastSlash = fUserHome
|
||||||
.lastIndexOf(ScpFileUtils.TARGET_SEPARATOR_CHAR);
|
.lastIndexOf(ScpFileUtils.TARGET_SEPARATOR_CHAR);
|
||||||
String name = fUserHome.substring(lastSlash + 1);
|
String name = fUserHome.substring(lastSlash + 1);
|
||||||
String parent = fUserHome.substring(0, lastSlash);
|
String parent = fUserHome.substring(0, lastSlash+1);
|
||||||
IHostFile rc = null;
|
IHostFile rc = null;
|
||||||
try {
|
try {
|
||||||
rc = getFile(parent, name, null);
|
rc = getFile(parent, name, null);
|
||||||
|
|
Loading…
Add table
Reference in a new issue