def loadInstrumentsInSearchPaths(cls, searchDirs): pluginPaths = [] for searchDir in searchDirs: print "Searching in searchDir", searchDir if os.path.exists(searchDir): pluginPaths.extend([ os.path.join(searchDir, f) for f in os.listdir(searchDir) if f.endswith(u'.instrument') ]) if not pluginPaths: return # Nothing to load pluginBundles = [ Bundle.bundleWithPath_(path) for path in pluginPaths ] pluginBundles = cls.sortPluginBundles(pluginBundles) for pluginBundle in pluginBundles: try: cls.loadInstrumentFromBundle(pluginBundle) except Exception, e: # FIXME: Should probably alert user pluginName = os.path.basename(pluginBundle.bundlePath()) NSLog(u"Could not load plugin: %s: %s: %s" % (pluginName, e.__class__.__name__, e))
def loadInstrumentFromBundlePath(cls, bundlePath): cls.loadInstrumentFromBundle(Bundle.bundleWithPath_(bundlePath))