Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions check_jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,7 @@

yaml = ruamel.yaml.YAML(typ="safe")


sysname = platform.system()
# on windows, try to get the appdata env var
# this *could* result in CACHE_DIR=None, which is fine, just skip caching in
# that case
if sysname == "Windows":
CACHE_DIR = os.getenv("LOCALAPPDATA", os.getenv("APPDATA"))
# macOS -> app support dir
elif sysname == "Darwin":
CACHE_DIR = os.path.expanduser("~/Library/Application Support")
# default for unknown platforms, namely linux behavior
# use XDG env var and default to ~/.cache/
else:
CACHE_DIR = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache/"))

if CACHE_DIR:
CACHE_DIR = os.path.join(CACHE_DIR, "jsonschema_validate")

CACHE_DIR = os.path.realpath(os.path.join(os.environ.get('XDG_CACHE_HOME') or os.path.expanduser('~/.cache'), 'jsonschema_validate'))

@contextlib.contextmanager
def cached_open(file_url, filename):
Expand Down