Chat protocol updates.

Module loading tries to load first from home dir, then the global dir.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@704 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-10-01 20:48:10 +00:00 committed by cras
commit c1a191955b
5 changed files with 51 additions and 60 deletions

View file

@ -238,22 +238,26 @@ char *module_get_name(const char *path)
GModule *module_open(const char *name)
{
struct stat statbuf;
GModule *module;
char *path, *str;
if (g_path_is_absolute(name))
path = g_strdup(name);
else {
path = g_module_build_path(MODULEDIR, name);
module = g_module_open(path, 0);
g_free(path);
if (module != NULL) return module;
/* module not found from global module dir,
check from home dir */
/* first try from home dir */
str = g_strdup_printf("%s/.irssi/modules", g_get_home_dir());
path = g_module_build_path(str, name);
g_free(str);
if (stat(path, &statbuf) == 0) {
module = g_module_open(path, 0);
g_free(path);
return module;
}
/* module not found from home dir, try global module dir */
path = g_module_build_path(MODULEDIR, name);
}
module = g_module_open(path, 0);