diff options
Diffstat (limited to 'remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java')
-rw-r--r-- | remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java b/remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java index cc47065b410..97c2ec2eacb 100644 --- a/remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java +++ b/remote/org.eclipse.cdt.remote.core/src/org/eclipse/cdt/remote/core/RemoteCommandLauncher.java @@ -42,19 +42,19 @@ import org.eclipse.remote.core.IRemoteServicesManager; import org.eclipse.remote.core.RemoteProcessAdapter; public class RemoteCommandLauncher implements ICommandLauncher { - + private static final String CYGWIN_PREFIX = "cygdrive"; //$NON-NLS-1$ - + private boolean usingLocalLauncher = false; /** * Convert a local (workspace) path into the remote equivalent. If the local path is not * absolute, then do nothing. - * + * * e.g. Suppose the local path is /u/local_user/workspace/local_project/subdir1/subdir2 * Suppose the remote project location is /home/remote_user/remote_project * Then the resulting path will be /home/remote_user/remote_project/subdir1/subdir2 - * + * * @param localPath absolute local path in the workspace * @param remote remote project * @return remote path that is the equivalent of the local path @@ -62,15 +62,15 @@ public class RemoteCommandLauncher implements ICommandLauncher { public static String makeRemote(String local, IRemoteResource remote) { return makeRemote(new Path(local), remote).toString(); } - + /** * Convert a local (workspace) path into the remote equivalent. If the local path is not * absolute, then do nothing. - * + * * e.g. Suppose the local path is /u/local_user/workspace/local_project/subdir1/subdir2 * Suppose the remote project location is /home/remote_user/remote_project * Then the resulting path will be /home/remote_user/remote_project/subdir1/subdir2 - * + * * @param localPath absolute local path in the workspace * @param remote remote project * @return remote path that is the equivalent of the local path @@ -79,10 +79,10 @@ public class RemoteCommandLauncher implements ICommandLauncher { if (!localPath.isAbsolute()) { return localPath; } - + IPath remoteLocation = remote.getResource().getLocation(); IPath remotePath = new Path(remote.getActiveLocationURI().getPath()); - + // Device mismatch, we might be in the presence of Cygwin or MinGW if (remoteLocation.getDevice() != null && localPath.getDevice() == null) { boolean isCygwin = localPath.segment(0).equals(CYGWIN_PREFIX); @@ -96,29 +96,29 @@ public class RemoteCommandLauncher implements ICommandLauncher { } return remotePath; } - + private static String getPathString(IPath path, boolean isCygwin) { String s = path.toString(); if (isCygwin) { - s = s.replaceAll("^([a-zA-Z]):", "/" + CYGWIN_PREFIX + "/$1"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + s = s.replaceAll("^([a-zA-Z]):", "/" + CYGWIN_PREFIX + "/$1"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ } else { s = s.replaceAll("^([a-zA-Z]):", "/$1"); //$NON-NLS-1$ //$NON-NLS-2$ } return s; } - + private ICommandLauncher fLocalLauncher; private boolean fShowCommand; private String[] fCommandArgs; private IRemoteConnection fConnection; private IRemoteProcess fRemoteProcess; private final Properties fEnvironment = new Properties(); - + public RemoteCommandLauncher() { this.fLocalLauncher = new CommandLauncher(); } - + public RemoteCommandLauncher(ICommandLauncher localLauncher) { this.fLocalLauncher = localLauncher; } @@ -141,8 +141,8 @@ public class RemoteCommandLauncher implements ICommandLauncher { } @Override - public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory, IProgressMonitor monitor) - throws CoreException { + public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory, + IProgressMonitor monitor) throws CoreException { ICommandLauncher localLauncher = CommandLauncherManager.getInstance().getCommandLauncher(getProject()); localLauncher.setProject(getProject()); localLauncher.setErrorMessage(getErrorMessage()); @@ -166,7 +166,7 @@ public class RemoteCommandLauncher implements ICommandLauncher { if (workingDirectory != null) { String remoteWorkingPath = makeRemote(workingDirectory.toString(), remRes); IRemoteFileService fileManager = fConnection.getService(IRemoteFileService.class); - IFileStore wd = fileManager.getResource(remoteWorkingPath); + IFileStore wd = fileManager.getResource(remoteWorkingPath); processBuilder.directory(wd); } Map<String, String> processEnv = processBuilder.environment(); @@ -295,11 +295,11 @@ public class RemoteCommandLauncher implements ICommandLauncher { @SuppressWarnings("deprecation") @Override public int waitAndRead(OutputStream out, OutputStream err) { - + if (usingLocalLauncher) { return fLocalLauncher.waitAndRead(out, err); } - + // otherwise remote process if (fShowCommand) { printCommandLine(out); @@ -319,7 +319,7 @@ public class RemoteCommandLauncher implements ICommandLauncher { if (usingLocalLauncher) { return fLocalLauncher.waitAndRead(out, err, monitor); } - + // otherwise remote process if (fShowCommand) { printCommandLine(out); |