fix: Make sure with have a projet before loading plugins.

This commit is contained in:
Sleepy Monax 2023-05-30 08:00:51 +02:00 committed by Sleepy Monax
parent 2abf53134d
commit a225097b13
2 changed files with 7 additions and 3 deletions

View file

@ -118,6 +118,9 @@ class Context(IContext):
def loadAllTargets() -> list[TargetManifest]:
projectRoot = project.root()
if projectRoot is None:
return []
pj = loadProject(projectRoot)
paths = list(
map(lambda e: os.path.join(const.EXTERN_DIR, e, const.TARGETS_DIR), pj.extern.keys())

View file

@ -23,12 +23,13 @@ def loadAll():
logger.info("Loading plugins...")
projectRoot = project.root()
pj = context.loadProject(projectRoot)
paths = list(map(lambda e: os.path.join(const.EXTERN_DIR, e), pj.extern.keys())) + ["."]
if projectRoot is None:
logger.info("Not in project, skipping plugin loading")
return
pj = context.loadProject(projectRoot)
paths = list(map(lambda e: os.path.join(const.EXTERN_DIR, e), pj.extern.keys())) + ["."]
for dirname in paths:
pluginDir = os.path.join(projectRoot, dirname, const.META_DIR, "plugins")