diff --git a/plugin/core/types.py b/plugin/core/types.py index fafed05c4..deb8e2368 100644 --- a/plugin/core/types.py +++ b/plugin/core/types.py @@ -872,6 +872,15 @@ def map_uri_on_payload(self, payload: Any, is_from_client_to_server: bool) -> An return payload + def map_client_path_to_server_uri(self, path: str) -> str: + return self.map_uri_on_payload(filename_to_uri(path), is_from_client_to_server=True) + + def map_server_uri_to_client_path(self, uri: str) -> str: + scheme, path = parse_uri(self.map_uri_on_payload(uri, is_from_client_to_server=False)) + if scheme not in ("file", "res"): + raise ValueError(f"{uri}: {scheme} URI scheme is unsupported") + return path + def is_disabled_capability(self, capability_path: str) -> bool: for value in self.disabled_capabilities.walk(capability_path): if isinstance(value, bool):