Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-05-06 11:49:32 -0400
committerUwe Stieber2014-05-06 11:49:32 -0400
commit2b488105cc770ccfaef4da0ca566979fff2b910f (patch)
tree20a055445b19a3f43d817a4a3a8bd2bdd87c9e4a
parent4e80e7aaac5f6b1b26316ccfbc9094781bdb3528 (diff)
downloadorg.eclipse.tcf-2b488105cc770ccfaef4da0ca566979fff2b910f.tar.gz
org.eclipse.tcf-2b488105cc770ccfaef4da0ca566979fff2b910f.tar.xz
org.eclipse.tcf-2b488105cc770ccfaef4da0ca566979fff2b910f.zip
Target Explorer: Fix path map resolver should not rely on Eclipse Path object implementation
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/services/PathMapResolverService.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/services/PathMapResolverService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/services/PathMapResolverService.java
index 97aea936e..b0e534e12 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/services/PathMapResolverService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/services/PathMapResolverService.java
@@ -34,18 +34,24 @@ public class PathMapResolverService extends AbstractService implements IPathMapR
Assert.isNotNull(rule);
Assert.isNotNull(fnm);
+ // Normalize file names to use slashes
+
+ String fnmSlash = fnm.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
String src = rule.getSource();
if (src == null) return null;
- if (!(new Path(src).isPrefixOf(new Path(fnm)))) return null;
+ String srcSlash = src.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!(fnmSlash.startsWith(srcSlash))) return null;
String host = rule.getHost();
if (host != null && host.length() > 0) {
if (!IPAddressUtil.getInstance().isLocalHost(host)) return null;
}
String dst = rule.getDestination();
if (dst == null || dst.length() == 0) return null;
- int l = src.length();
- if (dst.endsWith("/") && l < fnm.length() && fnm.charAt(l) == '/') l++; //$NON-NLS-1$
- return new Path(dst + fnm.substring(l)).toString();
+ int l = srcSlash.length();
+ if (dst.endsWith("/") && l < fnmSlash.length() && fnmSlash.charAt(l) == '/') l++; //$NON-NLS-1$
+
+ String fnmMapped = dst + fnmSlash.substring(l);
+ return fnmMapped.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
}
/* (non-Javadoc)
@@ -100,7 +106,9 @@ public class PathMapResolverService extends AbstractService implements IPathMapR
}
File f = new File(hostPath);
if (f.exists() && f.canRead()) {
- return hostPath;
+ // As a host path is returned, it should be in the OS
+ // specific expected format
+ return new Path(hostPath).toOSString();
}
}
}

Back to the top