Files
sunnypilot/tools/lib/filereader.py
Greg Hogan d5f4fdb1db eliminate xx filereader (#23514)
* eliminate xx filereader

* framereader cleanup
2022-01-13 15:56:54 -08:00

12 lines
336 B
Python

import os
from tools.lib.url_file import URLFile
DATA_PREFIX = os.getenv("DATA_PREFIX", "http://data-raw.internal/")
def FileReader(fn, debug=False):
if fn.startswith("cd:/"):
fn.replace("cd:/", DATA_PREFIX)
if fn.startswith("http://") or fn.startswith("https://"):
return URLFile(fn, debug=debug)
return open(fn, "rb")