diff options
| author | Moritz Eberl <moritz@semiodesk.com> | 2016-04-27 07:29:21 +0000 |
|---|---|---|
| committer | Moritz Eberl <moritz@semiodesk.com> | 2016-04-27 07:29:21 +0000 |
| commit | b8136b3cdbb75028e9eb815e69b735695453d70f (patch) | |
| tree | 09a44c034b7255fc8ad121a7c0e864415db0065e /src | |
| parent | Correct enumeration names. (diff) | |
| download | inkscape-b8136b3cdbb75028e9eb815e69b735695453d70f.tar.gz inkscape-b8136b3cdbb75028e9eb815e69b735695453d70f.zip | |
Fixed path resolution in plugin loader.
(bzr r14862.1.1)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/loader.cpp | 2 | ||||
| -rw-r--r-- | src/extension/loader.h | 6 | ||||
| -rw-r--r-- | src/extension/system.cpp | 13 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/extension/loader.cpp b/src/extension/loader.cpp index 110df3ae3..863a176ca 100644 --- a/src/extension/loader.cpp +++ b/src/extension/loader.cpp @@ -74,7 +74,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum _getInkscapeVersion GetInkscapeVersion = NULL; // build the path where to look for the plugin - gchar *path = g_build_filename(_baseDirectory, name, (char *) NULL); + gchar *path = g_build_filename(_baseDirectory.c_str(), name, (char *) NULL); module = g_module_open(path, G_MODULE_BIND_LOCAL); g_free(path); diff --git a/src/extension/loader.h b/src/extension/loader.h index 5d48bf861..0d3a69061 100644 --- a/src/extension/loader.h +++ b/src/extension/loader.h @@ -31,7 +31,7 @@ public: * * @param dir is the path where the plugin should be loaded from. */ - void set_base_directory(const gchar *dir) { + void set_base_directory(std::string dir) { _baseDirectory = dir; } @@ -51,7 +51,7 @@ public: Implementation::Implementation *load_implementation(Inkscape::XML::Document *doc); private: - const gchar *_baseDirectory; /**< The base directory to load a plugin from */ + std::string _baseDirectory; /**< The base directory to load a plugin from */ }; @@ -70,4 +70,4 @@ private: fill-column:99 End: */ -// vim:filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99:
\ No newline at end of file +// vim:filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99: diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 6b8e80d3c..3c623455a 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -47,7 +47,7 @@ namespace Extension { static void open_internal(Inkscape::Extension::Extension *in_plug, gpointer in_data); static void save_internal(Inkscape::Extension::Extension *in_plug, gpointer in_data); -static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp); +static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp, std::string* baseDir); /** * \return A new document created from the filename passed in @@ -422,7 +422,7 @@ get_print(gchar const *key) * case could apply to modules that are built in (like the SVG load/save functions). */ static Extension * -build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp) +build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp, std::string* baseDir) { enum { MODULE_EXTENSION, @@ -490,7 +490,9 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation } case MODULE_PLUGIN: { Inkscape::Extension::Loader loader = Inkscape::Extension::Loader(); - loader.set_base_directory ( Inkscape::Application::profile_path("extensions")); + if( baseDir != NULL){ + loader.set_base_directory ( *baseDir ); + } imp = loader.load_implementation(doc); break; } @@ -546,7 +548,8 @@ Extension * build_from_file(gchar const *filename) { Inkscape::XML::Document *doc = sp_repr_read_file(filename, INKSCAPE_EXTENSION_URI); - Extension *ext = build_from_reprdoc(doc, NULL); + std::string dir = Glib::path_get_dirname(filename); + Extension *ext = build_from_reprdoc(doc, NULL, &dir); if (ext != NULL) Inkscape::GC::release(doc); else @@ -568,7 +571,7 @@ build_from_mem(gchar const *buffer, Implementation::Implementation *in_imp) { Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), INKSCAPE_EXTENSION_URI); g_return_val_if_fail(doc != NULL, NULL); - Extension *ext = build_from_reprdoc(doc, in_imp); + Extension *ext = build_from_reprdoc(doc, in_imp, NULL); Inkscape::GC::release(doc); return ext; } |
