diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-05-22 12:30:56 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-05-22 12:30:56 +0200 |
commit | ec6f2c2e177eb99370a5dc58ce932aeff57f0648 (patch) | |
tree | 8c55e5c86f2fc5d074ecf25c6bb1353f1aeebc32 | |
parent | 59853abbbb82a322d3a60ff1accd70dcc0a04428 (diff) | |
download | weechat-ec6f2c2e177eb99370a5dc58ce932aeff57f0648.zip |
Fix bug with plugin path when loading with "/plugin load": replace ~ by user home directory
-rw-r--r-- | src/plugins/plugin.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 734385c47..33633a9ce 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -88,7 +88,7 @@ plugin_search (char *name) struct t_weechat_plugin * plugin_load (char *filename) { - char *full_name; + char *ptr_home, *full_name, *full_name2; void *handle; char *name, *author, *description, *version, *weechat_version, *license; char *charset; @@ -105,6 +105,15 @@ plugin_load (char *filename) if (!full_name) return NULL; + ptr_home = getenv ("HOME"); + full_name2 = string_replace (full_name, "~", ptr_home); + + if (full_name2) + { + free (full_name); + full_name = full_name2; + } + handle = dlopen (full_name, RTLD_GLOBAL | RTLD_NOW); if (!handle) { |