From fddd7d53a732a6c996da5982cf9d3f5d59bbfef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 26 Jun 2015 07:41:47 +0200 Subject: [PATCH] script: call function string_eval_path_home() to evaluate scripts path --- src/plugins/script/script-config.c | 42 +++--------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c index be836f2ce..b5333fe54 100644 --- a/src/plugins/script/script-config.c +++ b/src/plugins/script/script-config.c @@ -142,42 +142,6 @@ script_config_get_diff_command () return diff_command; } -/* - * Gets local directory for script. - * - * Note: result must be freed after use. - */ - -char * -script_config_get_path () -{ - const char *weechat_home; - char *path, *path2, *path3; - - path = NULL; - path2 = NULL; - path3 = NULL; - - path = weechat_string_eval_expression ( - weechat_config_string (script_config_scripts_path), NULL, NULL, NULL); - if (path) - { - path2 = weechat_string_expand_home (path); - if (path2) - { - weechat_home = weechat_info_get ("weechat_dir", NULL); - path3 = weechat_string_replace (path2, "%h", weechat_home); - } - } - - if (path) - free (path); - if (path2) - free (path2); - - return path3; -} - /* * Gets filename with script * (by default "/home/xxx/.weechat/script/plugins.xml.gz"). @@ -191,7 +155,8 @@ script_config_get_xml_filename () char *path, *filename; int length; - path = script_config_get_path (); + path = weechat_string_eval_path_home ( + weechat_config_string (script_config_scripts_path), NULL, NULL, NULL); length = strlen (path) + 64; filename = malloc (length); if (filename) @@ -217,7 +182,8 @@ script_config_get_script_download_filename (struct t_script_repo *script, char *path, *filename; int length; - path = script_config_get_path (); + path = weechat_string_eval_path_home ( + weechat_config_string (script_config_scripts_path), NULL, NULL, NULL); length = strlen (path) + 1 + strlen (script->name_with_extension) + ((suffix) ? strlen (suffix) : 0) + 1; filename = malloc (length);