Quick 'n dirty hack to find plugin in plugin dir

This commit is contained in:
Dave Davenport 2017-02-17 20:02:12 +01:00
parent 35deecec36
commit 85bd47e42f
2 changed files with 10 additions and 2 deletions

View file

@ -117,7 +117,8 @@ rofi_CFLAGS=\
-I$(top_builddir)/\
-Werror=missing-prototypes\
-DSYSCONFDIR=\"$(sysconfdir)\"\
-DTHEME_CONVERTER
-DTHEME_CONVERTER\
-DPLUGIN_PATH=\"${libdir}/rofi\"
rofi_LDADD=\
$(glib_LIBS)\

View file

@ -451,9 +451,15 @@ static int add_mode ( const char * token )
}
else if ( g_str_has_suffix ( token, G_MODULE_SUFFIX ) )
{
gchar *fn;
if ( token[0] != G_DIR_SEPARATOR) {
fn = g_build_filename ( PLUGIN_PATH, token, NULL );
} else {
fn = g_strdup ( token );
}
TICK_N("Loading module");
// Load module.
GModule *mod = g_module_open ( token, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL );
GModule *mod = g_module_open ( fn, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL );
if ( mod ) {
Mode *m = NULL;
if ( g_module_symbol ( mod, "mode", (gpointer *)&m) ){
@ -473,6 +479,7 @@ static int add_mode ( const char * token )
} else {
fprintf ( stderr, "Failed to open module: %s\n", token);
}
g_free(fn);
TICK_N("Loading module done");
}
else {