Skip to content

Commit

Permalink
logreader: support filesystem DATA_ENDPOINT (commaai#34340)
Browse files Browse the repository at this point in the history
* Check if DATA_ENDPOINT is a dir

* Change url resolution to support joining dirs
  • Loading branch information
fredyshox authored Jan 9, 2025
1 parent 89204b5 commit 5dd1972
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/lib/filereader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import posixpath
import socket
from urllib.parse import urlparse

Expand All @@ -8,6 +9,9 @@


def internal_source_available(url=DATA_ENDPOINT):
if os.path.isdir(url):
return True

try:
hostname = urlparse(url).hostname
port = urlparse(url).port or 80
Expand All @@ -22,7 +26,7 @@ def internal_source_available(url=DATA_ENDPOINT):

def resolve_name(fn):
if fn.startswith("cd:/"):
return fn.replace("cd:/", DATA_ENDPOINT)
return posixpath.join(DATA_ENDPOINT, fn[4:])
return fn


Expand Down

0 comments on commit 5dd1972

Please sign in to comment.