diff options
-rw-r--r-- | core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IFilesystemUtility.java | 10 | ||||
-rw-r--r-- | core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/FileSystemUtilityManager.java | 14 |
2 files changed, 23 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IFilesystemUtility.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IFilesystemUtility.java index a405f4bb44a..1d8bc054d50 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IFilesystemUtility.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IFilesystemUtility.java @@ -30,7 +30,7 @@ public interface IFilesystemUtility { * In the future, it would be better if EFS had an API for this. * * @param locationURI - * @return String representing the path, or null if there is an error or if there is no such physical file. + * @return String representing the path, or <code>null</code> if there is an error or if there is no such physical file. */ public String getPathFromURI(URI locationURI); @@ -53,4 +53,12 @@ public interface IFilesystemUtility { * @return URI */ public URI replacePathInURI(URI locationOnSameFilesystem, String path); + + /** + * Gets the path for this file as it appears when it is mapped into the filesystem. For + * unmapped filesystems, this would return the same path as getPathFromURI(URI locationURI) + * + * @return String representing the path, or <code>null</code> on error. + */ + public String getMappedPath(URI locationURI); } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/FileSystemUtilityManager.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/FileSystemUtilityManager.java index 33dd86a667b..6de31434c79 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/FileSystemUtilityManager.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/FileSystemUtilityManager.java @@ -151,5 +151,19 @@ public class FileSystemUtilityManager { return utility.replacePathInURI(uri, path); } } + + public String getMappedPath(URI uri) { + IFilesystemUtility utility = fSchemeToUtilityImplementerMap.get(uri.getScheme()); + + if(utility == null) { + // if there is no corresponding utility, then assume it's just the path field + return uri.getPath(); + + } + + else { + return utility.getMappedPath(uri); + } + } } |