diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-08 11:21:03 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-08 11:21:03 +0100 |
commit | 58d423319c40f3b3be6df0b9dd8d4e98916eaa93 (patch) | |
tree | 78a982e09b912293c3917cdeb0222bcb5918920f /src/plugins | |
parent | 682f5addc051f97fd66c6255f60abf36c2997e34 (diff) | |
download | weechat-58d423319c40f3b3be6df0b9dd8d4e98916eaa93.zip |
Return absolute path for info_get of "weechat_dir" (bug #27936)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/plugin-api.c | 9 |
1 files changed, 8 insertions, 1 deletions
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 <errno.h> +#include <limits.h> #include <stdlib.h> #include <unistd.h> #include <stdarg.h> @@ -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) { |