Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion mappyfile/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from __future__ import annotations
import json
import os
from pathlib import Path
import platform
from collections import OrderedDict
import logging
from functools import lru_cache
Expand Down Expand Up @@ -69,7 +71,13 @@ def get_schema_path(self, schemas_folder: str) -> str:

@lru_cache(maxsize=None)
def get_schemas_folder(self) -> str:
return os.path.join(os.path.dirname(os.path.realpath(__file__)), "schemas")
base = Path(__file__).parent
if platform.system() == "Windows":
# keep drive letters (and avoid UNC paths)
return str((base / "schemas").absolute())
else:
# resolve symlinks on Unix-like systems
return str((base / "schemas").resolve())

@lru_cache(maxsize=None)
def get_schema_file(self, schema_name: str) -> str:
Expand Down