From ec6f2c2e177eb99370a5dc58ce932aeff57f0648 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 22 May 2008 12:30:56 +0200 Subject: Fix bug with plugin path when loading with "/plugin load": replace ~ by user home directory --- src/plugins/plugin.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3