Skip to content

Commit

Permalink
revert last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rwols committed Jun 21, 2021
1 parent 7635781 commit f120b1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 5 additions & 5 deletions plugin/core/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ def filename_to_uri(file_name: str) -> str:
Convert a file name obtained from view.file_name() into an URI
"""
prefix = sublime.installed_packages_path()
if file_name.startswith(prefix) and not os.path.exists(file_name):
if file_name.startswith(prefix):
return _to_resource_uri(file_name, prefix)
prefix = sublime.packages_path()
if file_name.startswith(prefix) and not os.path.exists(file_name):
return _to_resource_uri(file_name, prefix)
file_name = os.path.realpath(file_name)
file_name = re.sub(r'^([A-Z]):\\', _lowercase_driveletter, file_name)
return urljoin("file:", pathname2url(file_name))
path = pathname2url(file_name)
re.sub(r"^([A-Z]):/", _lowercase_driveletter, path)
return urljoin("file:", path)


def view_to_uri(view: sublime.View, foreign_uri: Optional[str] = None) -> str:
Expand Down Expand Up @@ -62,4 +62,4 @@ def _lowercase_driveletter(match: Any) -> str:
"""
For compatibility with certain other language clients.
"""
return "{}:\\".format(match.group(1).lower())
return "{}:/".format(match.group(1).lower())
5 changes: 0 additions & 5 deletions tests/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ def test_converts_encoded_bad_drive_uri_to_path(self):
# url2pathname does not understand %3A
self.assertEqual("c:\\dir ectory\\file.txt", uri_to_filename("file:///c%3A/dir%20ectory/file.txt"))

@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
def test_converts_encoded_bad_drive_uri_to_path(self):
# url2pathname does not understand %3A
self.assertEqual("file:///c%3A/asdf/foo.txt", filename_to_uri("C:\\asdf\\foo.txt"))


class NixTests(unittest.TestCase):

Expand Down

0 comments on commit f120b1c

Please sign in to comment.