From 225698d006ab8492ece9dcdea45a50be363fcab0 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Sun, 20 Mar 2022 11:18:06 +0100 Subject: [PATCH] don't add default_modules dir if does not exists --- openpype/modules/base.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openpype/modules/base.py b/openpype/modules/base.py index 175957ae39..5a8d33aa6e 100644 --- a/openpype/modules/base.py +++ b/openpype/modules/base.py @@ -146,9 +146,16 @@ class _LoadCache: def get_default_modules_dir(): """Path to default OpenPype modules.""" + current_dir = os.path.abspath(os.path.dirname(__file__)) - return os.path.join(current_dir, "default_modules") + output = [] + for folder_name in ("default_modules", ): + path = os.path.join(current_dir, folder_name) + if os.path.exists(path) and os.path.isdir(path): + output.append(path) + + return output def get_dynamic_modules_dirs(): @@ -186,7 +193,7 @@ def get_dynamic_modules_dirs(): def get_module_dirs(): """List of paths where OpenPype modules can be found.""" _dirpaths = [] - _dirpaths.append(get_default_modules_dir()) + _dirpaths.extend(get_default_modules_dir()) _dirpaths.extend(get_dynamic_modules_dirs()) dirpaths = []