summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-06-26 07:41:47 +0200
committerSébastien Helleu <flashcode@flashtux.org>2015-06-26 07:41:47 +0200
commitfddd7d53a732a6c996da5982cf9d3f5d59bbfef4 (patch)
tree258327080998c22751c4419f14881fd49e7e56d7 /src
parentefdbd1ea13aaee8925b607d5a59a41d80f70b75b (diff)
downloadweechat-fddd7d53a732a6c996da5982cf9d3f5d59bbfef4.zip
script: call function string_eval_path_home() to evaluate scripts path
Diffstat (limited to 'src')
-rw-r--r--src/plugins/script/script-config.c42
1 files 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
@@ -143,42 +143,6 @@ script_config_get_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);