From: daid Date: Thu, 13 Feb 2014 11:37:40 +0000 (+0100) Subject: Fix crash if plugin directory does not exists. X-Git-Tag: 14.02-RC2~21 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=fcf9c521f009d60b1d4e6971176447195521dbd7;p=cura.git Fix crash if plugin directory does not exists. --- 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: