# HG changeset patch # User ivo # Date 1171987966 0 # Node ID 02333de881a77b1265ad7c050798acf1b38cc70c # Parent db58524617f5606deca9322c367db5d384586508 probe ~/.xmms/Plugins for plugins too, so users without root access on their machine can install them in their homedir and, if necessary, override system wide defaults. patch by Nicolas George, nicolas george at ens fr diff -r db58524617f5 -r 02333de881a7 libmpdemux/demux_xmms.c --- a/libmpdemux/demux_xmms.c Tue Feb 20 15:47:44 2007 +0000 +++ b/libmpdemux/demux_xmms.c Tue Feb 20 16:12:46 2007 +0000 @@ -155,19 +155,17 @@ xmms_length=length; } -static void init_plugins(){ +static void init_plugins_from_dir(const char *plugin_dir){ DIR *dir; struct dirent *ent; - no_plugins=0; - - dir = opendir(XMMS_INPUT_PLUGIN_DIR); + dir = opendir(plugin_dir); if (!dir) return; while ((ent = readdir(dir)) != NULL){ - char filename[strlen(XMMS_INPUT_PLUGIN_DIR)+strlen(ent->d_name)+4]; + char filename[strlen(plugin_dir)+strlen(ent->d_name)+4]; void* handle; - sprintf(filename,XMMS_INPUT_PLUGIN_DIR "/%s",ent->d_name); + sprintf(filename, "%s/%s", plugin_dir, ent->d_name); handle=dlopen(filename, RTLD_NOW); if(handle){ void *(*gpi) (void); @@ -190,6 +188,21 @@ closedir(dir); } +static void init_plugins(){ + char *home; + + no_plugins=0; + + home = getenv("HOME"); + if(home != NULL) { + char xmms_home[strlen(home) + 15]; + sprintf(xmms_home, "%s/.xmms/Plugins", home); + init_plugins_from_dir(xmms_home); + } + + init_plugins_from_dir(XMMS_INPUT_PLUGIN_DIR); +} + static void cleanup_plugins(){ while(no_plugins>0){ --no_plugins;