From fcf9c521f009d60b1d4e6971176447195521dbd7 Mon Sep 17 00:00:00 2001 From: daid Date: Thu, 13 Feb 2014 12:37:40 +0100 Subject: [PATCH] Fix crash if plugin directory does not exists. --- Cura/util/pluginInfo.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Cura/util/pluginInfo.py b/Cura/util/pluginInfo.py index 77b103d3..0d71e136 100644 --- a/Cura/util/pluginInfo.py +++ b/Cura/util/pluginInfo.py @@ -90,16 +90,17 @@ def getPluginList(pluginType): if _pluginList is None: _pluginList = [] for basePath in getPluginBasePaths(): - for filename in os.listdir(basePath): - if filename.startswith('.'): - continue - if filename.startswith('_'): - continue - if os.path.isdir(os.path.join(basePath, filename)): - if os.path.exists(os.path.join(basePath, filename, 'script.py')): - _pluginList.append(pluginInfo(basePath, os.path.join(filename, 'script.py'))) - elif filename.endswith('.py'): - _pluginList.append(pluginInfo(basePath, filename)) + if os.path.isdir(basePath): + for filename in os.listdir(basePath): + if filename.startswith('.'): + continue + if filename.startswith('_'): + continue + if os.path.isdir(os.path.join(basePath, filename)): + if os.path.exists(os.path.join(basePath, filename, 'script.py')): + _pluginList.append(pluginInfo(basePath, os.path.join(filename, 'script.py'))) + elif filename.endswith('.py'): + _pluginList.append(pluginInfo(basePath, filename)) ret = [] for plugin in _pluginList: if plugin.getType() == pluginType: -- 2.30.2