mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
modified loading of hooks to look for them also in host folder
This commit is contained in:
parent
2af2dbdca4
commit
84175aaa78
1 changed files with 27 additions and 8 deletions
|
|
@ -575,19 +575,38 @@ class ApplicationLaunchContext:
|
|||
def paths_to_launch_hooks(self):
|
||||
"""Directory paths where to look for launch hooks."""
|
||||
# This method has potential to be part of application manager (maybe).
|
||||
|
||||
# TODO find better way how to define dir path to default launch hooks
|
||||
import pype
|
||||
pype_dir = os.path.dirname(os.path.abspath(pype.__file__))
|
||||
hooks_dir = os.path.join(pype_dir, "hooks")
|
||||
paths = []
|
||||
|
||||
# TODO load additional studio paths from settings
|
||||
# TODO add paths based on used modules (like `ftrack`)
|
||||
paths = []
|
||||
subfolder_names = ["global", self.host_name, self.app_name]
|
||||
import pype
|
||||
pype_dir = os.path.dirname(os.path.abspath(pype.__file__))
|
||||
|
||||
# --- START: Backwards compatibility ---
|
||||
hooks_dir = os.path.join(pype_dir, "hooks")
|
||||
|
||||
subfolder_names = ["global", self.host_name]
|
||||
for subfolder_name in subfolder_names:
|
||||
path = os.path.join(hooks_dir, subfolder_name)
|
||||
if os.path.exists(path) and os.path.isdir(path):
|
||||
if (
|
||||
os.path.exists(path)
|
||||
and os.path.isdir(path)
|
||||
and path not in paths
|
||||
):
|
||||
paths.append(path)
|
||||
# --- END: Backwards compatibility ---
|
||||
|
||||
subfolders_list = (
|
||||
("hooks", "global"),
|
||||
("hosts", "tvpaint", self.host_name)
|
||||
)
|
||||
for subfolders in subfolders_list:
|
||||
path = os.path.join(pype_dir, *subfolders)
|
||||
if (
|
||||
os.path.exists(path)
|
||||
and os.path.isdir(path)
|
||||
and path not in paths
|
||||
):
|
||||
paths.append(path)
|
||||
return paths
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue