Yapsy looks at entire file system for plugins

192 views Asked by At

I've got an application that uses YAPSY for our plugin framework. The program specifies a default plugin directory and also lets the user specify a directory as well (which is saved in an XML file):

    # Get the default plugin directory, using XML
    path = os.path.expanduser('~')
    xml = xml_controller.Controller(path + '\.cxvrc.xml')
    xml.load_file()
    xml.get_plugin_directory()
    directory = ["plugins", xml.get_plugin_directory()]

    # Load the plugins from the default plugin directory.
    manager = PluginManager()
    manager.setPluginPlaces(directory)
    manager.setPluginInfoExtension('plugin')
    manager.collectPlugins()

The problem with this is that it's loading the user's plugins, no matter where they are on their file system. Essentially, it's ignoring the resulting string of the XML file query. Why could this be? An example of what

    xml.get_plugin_directory()

returns is a string: "C:\Documents and Settings\achilds". I thought that the collectPlugins() method should check the list of directories that I've supplied in setPluginPlaces(directory).

Any ideas why this finds all plugins on the user's file system (no matter what plugin directory they've specified)?

Thank you

1

There are 1 answers

1
adchilds On BEST ANSWER

Well, I've figured out the culprit. It seems that this was on my end, after closer inspection of how the YAPSY PluginManager works. PluginManager.locatePlugin() looks at the directories given, but then uses os.walk(given paths) to check every folder underneath the given paths.

Unknowingly, I set the directory to look in at "C:\Documents and Settings\achilds" and then placed my plugins on the desktop which happens to be at location: "C:\Documents and Settings\achilds\Desktop". So, PluginManager.locatePlugin() did what it's designed to do and searched through all directories within "C:\Documents and Settings\achilds", finding the directory that I had placed on the Desktop.