framereader: add cache_dir argument (#29904)

* framereader: add cache_dir argument

* make it an env var
old-commit-hash: 880157f5a6
This commit is contained in:
YassineYousfi
2023-09-14 14:36:32 -07:00
committed by GitHub
parent cc4cb7e078
commit eb7cad40dd
2 changed files with 16 additions and 16 deletions
+3 -3
View File
@@ -2,10 +2,10 @@ import os
import urllib.parse
from openpilot.common.file_helpers import mkdirs_exists_ok
DEFAULT_CACHE_DIR = os.path.expanduser("~/.commacache")
DEFAULT_CACHE_DIR = os.getenv("CACHE_ROOT", os.path.expanduser("~/.commacache"))
def cache_path_for_file_path(fn, cache_prefix=None):
dir_ = os.path.join(DEFAULT_CACHE_DIR, "local")
def cache_path_for_file_path(fn, cache_dir=DEFAULT_CACHE_DIR):
dir_ = os.path.join(cache_dir, "local")
mkdirs_exists_ok(dir_)
fn_parsed = urllib.parse.urlparse(fn)
if fn_parsed.scheme == '':