chiark / gitweb /
Fix crash if plugin directory does not exists.
authordaid <daid303@gmail.com>
Thu, 13 Feb 2014 11:37:40 +0000 (12:37 +0100)
committerdaid <daid303@gmail.com>
Thu, 13 Feb 2014 11:37:40 +0000 (12:37 +0100)
Cura/util/pluginInfo.py

index 77b103d31b2aa48a53f5e0bf24561aee968b9ffd..0d71e136842230904381bc0acdc95bd9fc3919a9 100644 (file)
@@ -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: