diff options
author | Greg Watson | 2014-09-26 13:39:33 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-04-01 19:51:49 +0000 |
commit | 8f5356e6cdabbb09a93679370868d9a5e28e3d68 (patch) | |
tree | af5c2df6f2f58af40cd75ea9461328b50afb39b5 | |
parent | e39e96bd9cbf0ff958080ebb1637f90288dd2a18 (diff) | |
download | org.eclipse.cdt-8f5356e6cdabbb09a93679370868d9a5e28e3d68.tar.gz org.eclipse.cdt-8f5356e6cdabbb09a93679370868d9a5e28e3d68.tar.xz org.eclipse.cdt-8f5356e6cdabbb09a93679370868d9a5e28e3d68.zip |
Bug 445149 - Check the authority section when converting a URI to a UNC
path
Change-Id: If0ee8b57bd938d6a7e8aa755668e3c742c2f8ab2
Signed-off-by: Greg Watson <g.watson@computer.org>
-rw-r--r-- | core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/UNCPathConverter.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/UNCPathConverter.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/UNCPathConverter.java index 783a82a0f9a..d638f8f35d1 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/UNCPathConverter.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/UNCPathConverter.java @@ -65,14 +65,19 @@ public abstract class UNCPathConverter { */ public static IPath toPath(URI uri) { IPath localPath = URIUtil.toPath(uri); - String host = uri.getHost(); - // try local path first - // that'll give EFS a chance to resolve a custom protocol path. - if (host != null && localPath == null) { - return new Path(host + uri.getPath()).makeUNC(true); - } else { + if (localPath != null) { return localPath; - } + } + // see if the uri has an authority part + String part = uri.getAuthority(); + if (part == null) { + // see if the uri has a host part + part = uri.getHost(); + if (part == null) { + return localPath; + } + } + return new Path(part).makeUNC(true).append(uri.getPath()); } /** |