mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 13:24:54 +01:00
introduced new function to get launcher storage and local dir
This commit is contained in:
parent
3b53093d12
commit
9ff4ec856b
2 changed files with 53 additions and 0 deletions
|
|
@ -9,6 +9,8 @@ from .local_settings import (
|
|||
AYONSettingsRegistry,
|
||||
OpenPypeSecureRegistry,
|
||||
OpenPypeSettingsRegistry,
|
||||
get_launcher_local_dir,
|
||||
get_launcher_storage_dir,
|
||||
get_local_site_id,
|
||||
get_ayon_username,
|
||||
get_openpype_username,
|
||||
|
|
@ -144,6 +146,8 @@ __all__ = [
|
|||
"AYONSettingsRegistry",
|
||||
"OpenPypeSecureRegistry",
|
||||
"OpenPypeSettingsRegistry",
|
||||
"get_launcher_local_dir",
|
||||
"get_launcher_storage_dir",
|
||||
"get_local_site_id",
|
||||
"get_ayon_username",
|
||||
"get_openpype_username",
|
||||
|
|
|
|||
|
|
@ -30,6 +30,55 @@ import ayon_api
|
|||
_PLACEHOLDER = object()
|
||||
|
||||
|
||||
def get_launcher_storage_dir(*subdirs: str) -> str:
|
||||
"""Get storage directory for launcher.
|
||||
|
||||
Storage directory is used for storing shims, addons, dependencies, etc.
|
||||
|
||||
It is not recommended, but the location can be shared across
|
||||
multiple machines.
|
||||
|
||||
Note:
|
||||
This function should be called at least once on bootstrap.
|
||||
|
||||
Args:
|
||||
*subdirs (str): Subdirectories relative to storage dir.
|
||||
|
||||
Returns:
|
||||
str: Path to storage directory.
|
||||
|
||||
"""
|
||||
storage_dir = os.getenv("AYON_LAUNCHER_STORAGE_DIR")
|
||||
if not storage_dir:
|
||||
storage_dir = get_ayon_appdirs()
|
||||
|
||||
return os.path.join(storage_dir, *subdirs)
|
||||
|
||||
|
||||
def get_launcher_local_dir(*subdirs: str) -> str:
|
||||
"""Get local directory for launcher.
|
||||
|
||||
Local directory is used for storing machine or user specific data.
|
||||
|
||||
The location is user specific.
|
||||
|
||||
Note:
|
||||
This function should be called at least once on bootstrap.
|
||||
|
||||
Args:
|
||||
*subdirs (str): Subdirectories relative to local dir.
|
||||
|
||||
Returns:
|
||||
str: Path to local directory.
|
||||
|
||||
"""
|
||||
storage_dir = os.getenv("AYON_LAUNCHER_LOCAL_DIR")
|
||||
if not storage_dir:
|
||||
storage_dir = get_ayon_appdirs()
|
||||
|
||||
return os.path.join(storage_dir, *subdirs)
|
||||
|
||||
|
||||
class AYONSecureRegistry:
|
||||
"""Store information using keyring.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue