mirror of
https://github.com/gryf/weechat-replacer.git
synced 2025-12-19 12:28:16 +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:
@@ -27,11 +27,10 @@ import weechat
|
|||||||
|
|
||||||
NAME = 'replacer'
|
NAME = 'replacer'
|
||||||
AUTHOR = 'Roman Dobosz <gryf73@gmail.com>'
|
AUTHOR = 'Roman Dobosz <gryf73@gmail.com>'
|
||||||
VERSION = '1.1'
|
VERSION = '1.2'
|
||||||
LICENSE = 'Apache 2'
|
LICENSE = 'Apache 2'
|
||||||
DESC = 'Word replacer for WeeChat'
|
DESC = 'Word replacer for WeeChat'
|
||||||
COMMAND = 'replacer'
|
COMMAND = 'replacer'
|
||||||
REPLACE_FILE = os.path.expandvars("$HOME/.weechat/replacement_map.json")
|
|
||||||
|
|
||||||
COLOR_DELIMITERS = weechat.color('chat_delimiters')
|
COLOR_DELIMITERS = weechat.color('chat_delimiters')
|
||||||
COLOR_NICK = weechat.color('chat_nick')
|
COLOR_NICK = weechat.color('chat_nick')
|
||||||
@@ -67,7 +66,8 @@ class Replacer(object):
|
|||||||
self.replacement_map = {}
|
self.replacement_map = {}
|
||||||
self._path = path
|
self._path = path
|
||||||
if not 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()
|
self._get_replacement_map()
|
||||||
|
|
||||||
def _get_replacement_map(self):
|
def _get_replacement_map(self):
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ class Weechat(object):
|
|||||||
def _set_position(self, val):
|
def _set_position(self, val):
|
||||||
self.position = val
|
self.position = val
|
||||||
|
|
||||||
|
def string_eval_path_home(self, path, pointers, extra_vars, options):
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
weechat = Weechat()
|
weechat = Weechat()
|
||||||
sys.modules['weechat'] = weechat
|
sys.modules['weechat'] = weechat
|
||||||
|
|||||||
Reference in New Issue
Block a user