mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 12:53:42 +02:00
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:
parent
8c2799b5f8
commit
c1a191955b
5 changed files with 51 additions and 60 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue