d
This commit is contained in:
@@ -192,6 +192,20 @@ class search_file(Cmdlet):
|
||||
|
||||
worker_id = str(uuid.uuid4())
|
||||
library_root = get_local_storage_path(config or {}) if get_local_storage_path else None
|
||||
|
||||
if not library_root:
|
||||
try:
|
||||
from Store import Store
|
||||
storage_registry = Store(config=config or {})
|
||||
# Try the first folder backend
|
||||
for name in storage_registry.list_backends():
|
||||
backend = storage_registry[name]
|
||||
if type(backend).__name__ == "Folder":
|
||||
library_root = expand_path(getattr(backend, "_location", None))
|
||||
if library_root:
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
db = None
|
||||
if library_root:
|
||||
@@ -553,7 +567,22 @@ class search_file(Cmdlet):
|
||||
from API.folder import API_folder_store
|
||||
|
||||
worker_id = str(uuid.uuid4())
|
||||
|
||||
from Store import Store
|
||||
storage_registry = Store(config=config or {})
|
||||
|
||||
library_root = get_local_storage_path(config or {})
|
||||
if not library_root:
|
||||
# Fallback for search-file: if no global "default" path is found,
|
||||
# try to use the specific backend mentioned in -store or the first available folder backend.
|
||||
backend_name = storage_backend or "default"
|
||||
try:
|
||||
backend = storage_registry[backend_name]
|
||||
if backend and type(backend).__name__ == "Folder":
|
||||
library_root = expand_path(getattr(backend, "_location", None))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if not library_root:
|
||||
log("No library root configured. Use the .config command to set up storage.", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user