Пример #1
0
void plugin_handler_find_plugin(void**) {
    assert_null(PluginHandler_findPlugin(0, "dummyFile", "dummyName", false));
    assert_null(PluginHandler_findPlugin(0, "dummyFile", "dummyName", true));
    assert_null(PluginHandler_findPlugin(0, "sourcecode_plugin", "Source Code View", false));
    assert_non_null(PluginHandler_findPlugin(0, "sourcecode_plugin", "Source Code View", true));
    assert_non_null(PluginHandler_findPlugin(0, "sourcecode_plugin", "Source Code View", false));

    assert_true(PluginHandler_addPlugin(OBJECT_DIR, "registers_plugin"));

    assert_non_null(PluginHandler_findPlugin(0, "registers_plugin", "Registers View", true));

    assert_non_null(PluginHandler_findPluginByFilename("registers_plugin"));
    assert_null(PluginHandler_findPluginByFilename("plugin_that_isnt_here"));

    PluginHandler_unloadAllPlugins();
}
Пример #2
0
PluginData* PluginHandler_reloadPlugin(PluginData* pluginData) {
    const char* filename = pluginData->filename;
    const char* fullName = string_clone(pluginData->fullFilename);

    printf("removing plugin...\n");

    removePlugin(pluginData);

    printf("adding plugin...%s\n", filename);

    PluginHandler_addPlugin(OBJECT_DIR, filename);

    printf("finding plugin\n");

    printf("trying to find %s\n", fullName);

    PluginData* newPluginData = PluginHandler_findPluginByFilename(fullName);

    printf("found plugin %p\n", newPluginData);

    return newPluginData;
}