diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java b/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java index 50093d715fe1..e8d224f29877 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java +++ b/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java @@ -214,30 +214,6 @@ public class VfsUtil extends VfsUtilCore { return virtualFile; } - /** - * @return correct URL, must be used only for external communication - */ - @NotNull - public static URI toUri(@NotNull VirtualFile file) { - String path = file.getPath(); - try { - String protocol = file.getFileSystem().getProtocol(); - if (file.isInLocalFileSystem()) { - if (SystemInfo.isWindows && path.charAt(0) != '/') { - path = '/' + path; - } - return new URI(protocol, "", path, null, null); - } - if (URLUtil.HTTP_PROTOCOL.equals(protocol)) { - return new URI(URLUtil.HTTP_PROTOCOL + URLUtil.SCHEME_SEPARATOR + path); - } - return new URI(protocol, path, null); - } - catch (URISyntaxException e) { - throw new IllegalArgumentException(e); - } - } - /** * @return correct URL, must be used only for external communication */ @@ -627,5 +603,27 @@ public class VfsUtil extends VfsUtilCore { return null; } + + /** @deprecated incorrect, use {@link #toUri(String)} if needed (to be removed in IDEA 2019 */ + @NotNull + public static URI toUri(@NotNull VirtualFile file) { + String path = file.getPath(); + try { + String protocol = file.getFileSystem().getProtocol(); + if (file.isInLocalFileSystem()) { + if (SystemInfo.isWindows && path.charAt(0) != '/') { + path = '/' + path; + } + return new URI(protocol, "", path, null, null); + } + if (URLUtil.HTTP_PROTOCOL.equals(protocol)) { + return new URI(URLUtil.HTTP_PROTOCOL + URLUtil.SCHEME_SEPARATOR + path); + } + return new URI(protocol, path, null); + } + catch (URISyntaxException e) { + throw new IllegalArgumentException(e); + } + } // } \ No newline at end of file