diff options
author | 2007-02-20 16:12:46 +0000 | |
---|---|---|
committer | 2007-02-20 16:12:46 +0000 | |
commit | b12556dd5849015c6ebea2928655a53c940fb7f3 (patch) | |
tree | 8938d518b40eda0b856d2d6f421df27470ecdb51 | |
parent | 0cbf197d0dd2d8929ed5612b8c20ef359b7fe861 (diff) |
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
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22283 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpdemux/demux_xmms.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/libmpdemux/demux_xmms.c b/libmpdemux/demux_xmms.c index 54307f208b..315af24b2c 100644 --- a/libmpdemux/demux_xmms.c +++ b/libmpdemux/demux_xmms.c @@ -155,19 +155,17 @@ static void input_set_info(char* title,int length, int rate, int freq, int nch){ 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 @@ static void init_plugins(){ 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; |