1
0
mirror of https://github.com/gryf/weechat-replacer.git synced 2025-12-18 12:00:18 +01:00

Calculate weechat home using string_eval_path_home.

Using different path for the weechat configuration results in inability
to find right replacemenet_map json file. Fix it by using
string_eval_path_home method, which will return right weechat config
directory.
This commit is contained in:
2020-11-02 20:22:33 +01:00
parent 943aec432f
commit 7fe8df4c56
2 changed files with 6 additions and 3 deletions

View File

@@ -27,11 +27,10 @@ import weechat
NAME = 'replacer'
AUTHOR = 'Roman Dobosz <gryf73@gmail.com>'
VERSION = '1.1'
VERSION = '1.2'
LICENSE = 'Apache 2'
DESC = 'Word replacer for WeeChat'
COMMAND = 'replacer'
REPLACE_FILE = os.path.expandvars("$HOME/.weechat/replacement_map.json")
COLOR_DELIMITERS = weechat.color('chat_delimiters')
COLOR_NICK = weechat.color('chat_nick')
@@ -67,7 +66,8 @@ class Replacer(object):
self.replacement_map = {}
self._path = path
if not path:
self._path = REPLACE_FILE
path = '%h/replacement_map.json'
self._path = weechat.string_eval_path_home(path, {}, {}, {})
self._get_replacement_map()
def _get_replacement_map(self):

View File

@@ -66,6 +66,9 @@ class Weechat(object):
def _set_position(self, val):
self.position = val
def string_eval_path_home(self, path, pointers, extra_vars, options):
return path
weechat = Weechat()
sys.modules['weechat'] = weechat