Skip to content

Commit

Permalink
Fix path handling for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
danielballan committed Jan 16, 2025
1 parent 1ffff43 commit 6292e0a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tiled/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,20 +718,19 @@ def path_from_uri(uri) -> Path:
"""
parsed = urlparse(uri)
if parsed.scheme == "file":
path = parsed.path
if platform.system() == "Windows":
# We slice because we need "C:/..." not "/C:/...".
path = Path(parsed.path[1:])
else:
path = Path(parsed.path)
elif parsed.scheme == "sqlite":
# The path begins after the third slash.
path = parsed.path[1:]
path = Path(parsed.path[1:])
else:
raise ValueError(
"Supported schemes are 'file' and 'sqlite'. "
f"Did not recognize scheme {parsed.scheme!r}"
)
if platform.system() == "Windows":
# We slice because we need "C:/..." not "/C:/...".
path = Path(path[1:])
else:
path = Path(path)
return path


Expand Down

0 comments on commit 6292e0a

Please sign in to comment.