mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-01 17:13:44 +08:00
ui/models: handle missing files during cache size calculation (#1958)
This commit is contained in:
@@ -115,8 +115,12 @@ class ModelsLayout(Widget):
|
||||
def calculate_cache_size():
|
||||
cache_size = 0.0
|
||||
if os.path.exists(CUSTOM_MODEL_PATH):
|
||||
cache_size = sum(os.path.getsize(os.path.join(CUSTOM_MODEL_PATH, file)) for file in os.listdir(CUSTOM_MODEL_PATH)) / (1024**2)
|
||||
return cache_size
|
||||
for file in os.listdir(CUSTOM_MODEL_PATH):
|
||||
try:
|
||||
cache_size += os.path.getsize(os.path.join(CUSTOM_MODEL_PATH, file))
|
||||
except OSError:
|
||||
continue
|
||||
return cache_size / (1024**2)
|
||||
|
||||
def _clear_cache(self):
|
||||
def _callback(response):
|
||||
|
||||
Reference in New Issue
Block a user