1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

bug 388755: Added extra check for schema "file" while fixing path "/C:/path" on Windows in EFSExtensionProvider

This commit is contained in:
Andrew Gvozdev 2012-09-05 15:57:20 -04:00
parent 1de79e8703
commit 8fb2b6a3c6

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.core;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.URIUtil; import org.eclipse.core.runtime.URIUtil;
@ -56,9 +57,12 @@ public abstract class EFSExtensionProvider {
*/ */
public String getPathFromURI(URI locationURI) { public String getPathFromURI(URI locationURI) {
String path = locationURI.getPath(); String path = locationURI.getPath();
// URI path on Windows is represented as "/C:/path" String schema = locationURI.getScheme();
if (path != null && Platform.getOS().equals(Platform.WS_WIN32) && path.matches("/[A-Za-z]:.*")) { //$NON-NLS-1$ if (schema != null && schema.equals(EFS.SCHEME_FILE) && Platform.getOS().equals(Platform.WS_WIN32)) {
path = path.substring(1); // URI path on Windows is represented as "/C:/path"
if (path != null && path.matches("/[A-Za-z]:.*")) { //$NON-NLS-1$
path = path.substring(1);
}
} }
return path; return path;
} }