Merge branch 'develop' into bugfix/ceil-height

This commit is contained in:
Jakub Trllo 2025-03-24 16:07:01 +01:00 committed by GitHub
commit 24ffa07413
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions

View file

@ -9,6 +9,7 @@ from .local_settings import (
AYONSettingsRegistry,
get_launcher_local_dir,
get_launcher_storage_dir,
get_addons_resources_dir,
get_local_site_id,
get_ayon_username,
)
@ -142,6 +143,7 @@ __all__ = [
"AYONSettingsRegistry",
"get_launcher_local_dir",
"get_launcher_storage_dir",
"get_addons_resources_dir",
"get_local_site_id",
"get_ayon_username",

View file

@ -96,6 +96,30 @@ def get_launcher_local_dir(*subdirs: str) -> str:
return os.path.join(storage_dir, *subdirs)
def get_addons_resources_dir(addon_name: str, *args) -> str:
"""Get directory for storing resources for addons.
Some addons might need to store ad-hoc resources that are not part of
addon client package (e.g. because of size). Studio might define
dedicated directory to store them with 'AYON_ADDONS_RESOURCES_DIR'
environment variable. By default, is used 'addons_resources' in
launcher storage (might be shared across platforms).
Args:
addon_name (str): Addon name.
*args (str): Subfolders in resources directory.
Returns:
str: Path to resources directory.
"""
addons_resources_dir = os.getenv("AYON_ADDONS_RESOURCES_DIR")
if not addons_resources_dir:
addons_resources_dir = get_launcher_storage_dir("addons_resources")
return os.path.join(addons_resources_dir, addon_name, *args)
class AYONSecureRegistry:
"""Store information using keyring.