Skip to content

Commit

Permalink
Update get_cache_folder for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Bram Vanroy authored and Bram Vanroy committed Sep 16, 2022
1 parent 7472361 commit 1fe5f56
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions comet/download_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import subprocess
import urllib.request
import zipfile
from pathlib import Path
from typing import List
from urllib.parse import urlparse

Expand All @@ -29,13 +30,12 @@


def get_cache_folder():
if "HOME" in os.environ:
cache_directory = os.environ["HOME"] + "/.cache/torch/unbabel_comet/"
if not os.path.exists(cache_directory):
os.makedirs(cache_directory)
return cache_directory
else:
raise Exception("HOME environment variable is not defined.")
home_dir = Path(os.environ["HOME"]) if "HOME" in os.environ else Path.home()
cache_directory = home_dir / ".cache" / "torch" / "unbabel_comet"
if not cache_directory.exists():
cache_directory.mkdir(exist_ok=True, parents=True)

return str(cache_directory)


def _reporthook(t):
Expand Down

0 comments on commit 1fe5f56

Please sign in to comment.