diff --git a/plugin/core/types.py b/plugin/core/types.py index 8ae09bfb1..06710a094 100644 --- a/plugin/core/types.py +++ b/plugin/core/types.py @@ -855,7 +855,7 @@ def map_client_path_to_server_uri(self, path: str) -> str: def map_server_uri_to_client_path(self, uri: str) -> str: scheme, path = parse_uri(uri) - if scheme != "file": + if scheme not in ("file", "res"): raise ValueError("{}: {} URI scheme is unsupported".format(uri, scheme)) if self.path_maps: for path_map in self.path_maps: diff --git a/plugin/core/url.py b/plugin/core/url.py index 024379105..1f6699f91 100644 --- a/plugin/core/url.py +++ b/plugin/core/url.py @@ -80,7 +80,7 @@ def _to_resource_uri(path: str, prefix: str) -> str: See: https://github.com/sublimehq/sublime_text/issues/3742 """ - return "res://Packages{}".format(pathname2url(path[len(prefix):])) + return "res:/Packages{}".format(pathname2url(path[len(prefix):])) def _uppercase_driveletter(match: Any) -> str: diff --git a/plugin/locationpicker.py b/plugin/locationpicker.py index 2802d5118..8fb390cf3 100644 --- a/plugin/locationpicker.py +++ b/plugin/locationpicker.py @@ -47,7 +47,7 @@ def open_basic_file( if uri.startswith("file:"): filename = session.config.map_server_uri_to_client_path(uri) else: - prefix = 'res://Packages' # Note: keep in sync with core/url.py#_to_resource_uri + prefix = 'res:/Packages' # Note: keep in sync with core/url.py#_to_resource_uri assert uri.startswith(prefix) filename = sublime.packages_path() + url2pathname(uri[len(prefix):]) # Window.open_file can only focus and scroll to a location in a resource file if it is already opened diff --git a/tests/test_url.py b/tests/test_url.py index 9d782418a..31a06556f 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -62,7 +62,7 @@ class MultiplatformTests(unittest.TestCase): def test_resource_path(self): uri = filename_to_uri(os.path.join(sublime.installed_packages_path(), "Package Control", "dir", "file.py")) - self.assertEqual(uri, "res://Packages/Package%20Control/dir/file.py") + self.assertEqual(uri, "res:/Packages/Package%20Control/dir/file.py") def test_buffer_uri(self): view = sublime.active_window().active_view()