summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Tepavich2012-11-07 16:02:26 (EST)
committerPawel Piech2012-11-07 16:42:39 (EST)
commit1546d1e1496fb2fe0a8d28a4139305bb6fe73bc1 (patch)
tree4b77be55735331903d6c25c900eb93a019c0bda5
parent9c7f88f34f3b0988cfa004374302937e5ba528b2 (diff)
downloadorg.eclipse.cdt-1546d1e1496fb2fe0a8d28a4139305bb6fe73bc1.zip
org.eclipse.cdt-1546d1e1496fb2fe0a8d28a4139305bb6fe73bc1.tar.gz
org.eclipse.cdt-1546d1e1496fb2fe0a8d28a4139305bb6fe73bc1.tar.bz2
Bug 393791 - Cannot substitute Windows path to Unix path on Linux
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java52
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainerType.java2
2 files changed, 26 insertions, 28 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java
index 8735d96..751c3ed 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java
@@ -74,34 +74,32 @@ public class MapEntrySourceContainer extends AbstractSourceContainer {
public static IPath createPath(String path) {
if (path == null)
return null;
- if (path.contains("\\")) { //$NON-NLS-1$
- // handle Windows slashes and canonicalize
- path = path.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // also check for device or UNC
- int firstSep = path.indexOf("/"); //$NON-NLS-1$
- int idx = path.indexOf(":"); //$NON-NLS-1$
- // ':' indicates a Windows device separator if it comes before
- // the first segment separator
- if (idx > 0 && (firstSep < 0 || idx < firstSep)) {
- String device = path.substring(0, idx + 1);
- path = path.substring(idx + 1);
- return new Path(path).setDevice(device);
- } else {
- // Cygwin or UNC path
- if (path.startsWith("//")) { //$NON-NLS-1$
- String network;
- idx = path.indexOf("/", 2); //$NON-NLS-1$
- if (idx > 0) {
- network = path.substring(0, idx);
- path = path.substring(idx);
- } else {
- network = path;
- path = ""; //$NON-NLS-1$
- }
- return new Path(network, path).makeUNC(true);
+
+ // Check for windows full-path formatting.
+ if (path.matches("^([a-zA-Z])[:](.*)$")) { //$NON-NLS-1$
+ String device = null;
+ String missingfile = path.replace("\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
+ int idx = missingfile.indexOf(":"); //$NON-NLS-1$
+ if ( idx > 0 ) {
+ device = missingfile.substring(0, idx + 1);
+ missingfile = missingfile.substring(idx + 1);
+ }
+ return new Path(device, missingfile);
+ }
+
+ int idx = 0;
+ // Cygwin or UNC path
+ if (path.startsWith("//")) { //$NON-NLS-1$
+ String network;
+ idx = path.indexOf("/", 2); //$NON-NLS-1$
+ if (idx > 0) {
+ network = path.substring(0, idx);
+ path = path.substring(idx);
+ } else {
+ network = path;
+ path = ""; //$NON-NLS-1$
}
+ return new Path(network, path).makeUNC(true);
}
// fallthrough
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainerType.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainerType.java
index 7e536e8..a87f1fe 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainerType.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainerType.java
@@ -37,7 +37,7 @@ public class MapEntrySourceContainerType extends AbstractSourceContainerTypeDele
Element element = (Element)node;
if (ELEMENT_NAME.equals(element.getNodeName())) {
String path = element.getAttribute(BACKEND_PATH);
- IPath backend = new Path(path);
+ IPath backend = MapEntrySourceContainer.createPath(path);
if (!backend.isValidPath(path)) {
abort(InternalSourceLookupMessages.MapEntrySourceContainerType_0, null);
}