mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 06:46:00 +00:00
Apply the same lazy-factory pattern to FSLaunchboxHandler and FSSyncHandler
that ssh_sync_handler now uses. With both opt-in features deferred to
first-use, the tolerate_missing_base escape hatch on FSHandler is no longer
needed — every handler now fails loudly on mkdir failure, which is the
right behavior for the always-on core paths (assets, library, resources).
Touched call sites:
- resources_handler._resolve_local_file_uri (launchbox)
- sync_watcher.py, endpoints/device.py, tasks/manual/sync_folder_scan.py
(fs_sync)
Net effect:
- Default installs never poke /romm/launchbox or /romm/sync at startup.
- Misconfigured opt-in users get a clear, actionable PermissionError at
the call site instead of a silent warning followed by mystery failures.
- tolerate_missing_base, its tests, and one stale log import are gone.
20 lines
537 B
Python
20 lines
537 B
Python
import functools
|
|
|
|
from config import LAUNCHBOX_BASE_PATH
|
|
from handler.filesystem.base_handler import FSHandler
|
|
|
|
|
|
class FSLaunchboxHandler(FSHandler):
|
|
def __init__(self) -> None:
|
|
super().__init__(base_path=LAUNCHBOX_BASE_PATH)
|
|
|
|
|
|
@functools.cache
|
|
def get_fs_launchbox_handler() -> FSLaunchboxHandler:
|
|
"""Lazily instantiate the LaunchBox handler on first use.
|
|
|
|
Deferred so that startup doesn't fail when the LaunchBox feature is
|
|
unconfigured or its base path is not writable.
|
|
"""
|
|
return FSLaunchboxHandler()
|