diff options
author | Timo Sirainen <cras@irssi.org> | 2001-09-11 17:38:47 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-09-11 17:38:47 +0000 |
commit | c7f7ec439180cfdccad5220cf54448eb008c6d77 (patch) | |
tree | 491d49ed6523302a4b7e7046d63a619888297d7b /src | |
parent | b5d317536c821357bf4edfe62fa476e99e711966 (diff) | |
download | irssi-c7f7ec439180cfdccad5220cf54448eb008c6d77.zip |
/LOAD fixes for modules with no core part, and /LOAD ~/...
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1788 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/core/modules-load.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/core/modules-load.c b/src/core/modules-load.c index ddaad721..7c6743fe 100644 --- a/src/core/modules-load.c +++ b/src/core/modules-load.c @@ -25,6 +25,7 @@ #include "settings.h" #include "commands.h" +#include "misc.h" #ifdef HAVE_GMODULE @@ -35,7 +36,7 @@ static char *module_get_name(const char *path, int *start, int *end) char *module_name, *ptr; name = NULL; - if (g_path_is_absolute(path)) { + if (*path == '~' || g_path_is_absolute(path)) { name = strrchr(path, G_DIR_SEPARATOR); if (name != NULL) name++; } @@ -106,7 +107,7 @@ static GModule *module_open(const char *name) GModule *module; char *path, *str; - if (g_path_is_absolute(name) || + if (g_path_is_absolute(name) || *name == '~' || (*name == '.' && name[1] == G_DIR_SEPARATOR)) path = g_strdup(name); else { @@ -287,21 +288,24 @@ static int module_load_full(const char *path, const char *rootmodule, modules given in `prefixes' (like irc, fe, fe_text, ..) */ int module_load(const char *path, char **prefixes) { - char *name, *submodule, *rootmodule; + char *exppath, *name, *submodule, *rootmodule; int start, end, ret; g_return_val_if_fail(path != NULL, FALSE); - name = module_get_name(path, &start, &end); + exppath = convert_home(path); + + name = module_get_name(exppath, &start, &end); rootmodule = module_get_root(name, prefixes); submodule = module_get_sub(name, rootmodule); g_free(name); - ret = module_load_full(path, rootmodule, submodule, + ret = module_load_full(exppath, rootmodule, submodule, start, end, prefixes); g_free(rootmodule); g_free(submodule); + g_free(exppath); return ret; } @@ -309,17 +313,19 @@ int module_load(const char *path, char **prefixes) int module_load_sub(const char *path, const char *submodule, char **prefixes) { GString *full_path; - char *name, *rootmodule; + char *exppath, *name, *rootmodule; int start, end, ret; g_return_val_if_fail(path != NULL, FALSE); g_return_val_if_fail(submodule != NULL, FALSE); - name = module_get_name(path, &start, &end); + exppath = convert_home(path); + + name = module_get_name(exppath, &start, &end); rootmodule = module_get_root(name, prefixes); g_free(name); - full_path = g_string_new(path); + full_path = g_string_new(exppath); if (strcmp(submodule, "core") == 0) g_string_insert(full_path, end, "_core"); else { @@ -332,6 +338,7 @@ int module_load_sub(const char *path, const char *submodule, char **prefixes) g_string_free(full_path, TRUE); g_free(rootmodule); + g_free(exppath); return ret; } |