From 58d423319c40f3b3be6df0b9dd8d4e98916eaa93 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 8 Mar 2010 11:21:03 +0100 Subject: Return absolute path for info_get of "weechat_dir" (bug #27936) --- src/plugins/plugin-api.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 4e4679a61..48212cb60 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -24,6 +24,7 @@ #endif #include +#include #include #include #include @@ -260,6 +261,7 @@ plugin_api_info_get_internal (void *data, const char *info_name, { time_t inactivity; static char value[32], version_number[32] = { '\0' }; + static char weechat_dir_absolute_path[PATH_MAX] = { '\0' }; /* make C compiler happy */ (void) data; @@ -291,7 +293,12 @@ plugin_api_info_get_internal (void *data, const char *info_name, } else if (string_strcasecmp (info_name, "weechat_dir") == 0) { - return weechat_home; + if (!weechat_dir_absolute_path[0]) + { + realpath (weechat_home, weechat_dir_absolute_path); + } + return (weechat_dir_absolute_path[0]) ? + weechat_dir_absolute_path : weechat_home; } else if (string_strcasecmp (info_name, "weechat_libdir") == 0) { -- cgit v1.2.3