mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
Bug 438476 - Fix autotools MinGW and Cygwin build
Change-Id: I10bfb868718bf564dc74d53be6ff7453f1349dc5 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/29435 Tested-by: Hudson CI
This commit is contained in:
parent
29b783155f
commit
b280f247ae
2 changed files with 27 additions and 4 deletions
|
@ -1113,9 +1113,9 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
|
|||
String s = path.toString();
|
||||
if (getOSName().equals(Platform.OS_WIN32)) {
|
||||
if (getWinOSType().equals("cygwin")) {
|
||||
s = s.replaceAll("^([A-Z])(:)", "/cygdrive/$1");
|
||||
s = s.replaceAll("^([a-zA-Z]):", "/cygdrive/$1");
|
||||
} else {
|
||||
s = s.replaceAll("^([A-Z])(:)", "/$1");
|
||||
s = s.replaceAll("^([a-zA-Z]):", "/$1");
|
||||
}
|
||||
}
|
||||
return s;
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Marc-Andre Laperle (Ericsson) - Fix MinGW and Cygwin build (Bug 438476)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.remote.core;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
@ -36,6 +36,8 @@ import org.eclipse.remote.core.RemoteServices;
|
|||
|
||||
public class RemoteCommandLauncher implements ICommandLauncher {
|
||||
|
||||
private static final String CYGWIN_PREFIX = "cygdrive"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Convert a local (workspace) path into the remote equivalent. If the local path is not
|
||||
* absolute, then do nothing.
|
||||
|
@ -68,14 +70,35 @@ public class RemoteCommandLauncher implements ICommandLauncher {
|
|||
if (!localPath.isAbsolute()) {
|
||||
return localPath;
|
||||
}
|
||||
IPath relativePath = localPath.makeRelativeTo(remote.getResource().getLocation());
|
||||
|
||||
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);
|
||||
remoteLocation = new Path(getPathString(remoteLocation, isCygwin));
|
||||
remotePath = new Path(getPathString(remotePath, isCygwin));
|
||||
}
|
||||
|
||||
IPath relativePath = localPath.makeRelativeTo(remoteLocation);
|
||||
if (!relativePath.isEmpty()) {
|
||||
remotePath = remotePath.append(relativePath);
|
||||
}
|
||||
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$
|
||||
} else {
|
||||
s = s.replaceAll("^([a-zA-Z]):", "/$1"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
private final ICommandLauncher fLocalLauncher = new CommandLauncher();
|
||||
private boolean fShowCommand;
|
||||
private String[] fCommandArgs;
|
||||
|
|
Loading…
Add table
Reference in a new issue