Logo Search packages:      
Sourcecode: inkscape version File versions

bool Inkscape::Extension::Implementation::Plugin::check ( Inkscape::Extension::Extension module  )  [virtual]

Just check to make sure everything exists. This makes sure that the loadable file exits.

Verify any dependencies.

Parameters:
module Unused.
Returns:
The status of the check. TRUE means that it passed.
This function builds the path name out of the XML definition of the plugin. It does this by looking for the name parameter. It then uses build_path to add the .so or .dll and adds in the INKSCAPE_PLUGINDIR to the front of it. Then the file_test function is used to make sure it exists.

Reimplemented from Inkscape::Extension::Implementation::Implementation.

Definition at line 153 of file plugin.cpp.

References Inkscape::Extension::Extension::get_repr().

{
    SPRepr * child_repr = sp_repr_children(module->get_repr());
    const gchar * name = NULL;
    while (child_repr != NULL) {
        if (!strcmp(sp_repr_name(child_repr), "plugin")) {
            child_repr = sp_repr_children(child_repr);
            while (child_repr != NULL) {
                if (!strcmp(sp_repr_name(child_repr), "name")) {
                    name = sp_repr_content(sp_repr_children(child_repr));
                }
                child_repr = sp_repr_next(child_repr);
            }
        }
        child_repr = sp_repr_next(child_repr);
    }

    if (name == NULL) {
        return FALSE;
    }

    std::string path = Glib::Module::build_path(INKSCAPE_PLUGINDIR, name);
    // std::cout << "Path: " << path << std::endl;
    if (!Glib::file_test(path, Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_EXECUTABLE)) {
        // std::cout << "Failed!" << std::endl;
        return FALSE;
    }

    // std::cout << "No Problem." << std::endl;
    return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index