diff options
-rw-r--r-- | docs/Options.md | 2 | ||||
-rw-r--r-- | wee_slack.py | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/docs/Options.md b/docs/Options.md index 93b52e1..cf26ca2 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -92,7 +92,7 @@ slack` after changing it to take effect. **Default:** `` -**Description:** If set, file attachments will be automatically downloaded to this location. +**Description:** If set, file attachments will be automatically downloaded to this location. "%h" will be replaced by WeeChat home, "~/.weechat" by default. ### group_name_prefix diff --git a/wee_slack.py b/wee_slack.py index d2c94e4..c1225e5 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2795,6 +2795,8 @@ def download_files(message_json, **kwargs): download_location = config.files_download_location if not download_location: return + download_location = download_location.replace("%h", w.info_get("weechat_dir", "")) + if not os.path.exists(download_location): try: os.makedirs(download_location) @@ -4344,7 +4346,8 @@ class PluginConfig(object): 'files_download_location': Setting( default='', desc='If set, file attachments will be automatically downloaded' - ' to this location.'), + ' to this location. "%h" will be replaced by WeeChat home,' + ' "~/.weechat" by default.'), 'group_name_prefix': Setting( default='&', desc='The prefix of buffer names for groups (private channels).'), |