Skip to content

Commit c21cd4d

Browse files
committed
cron.py 0.5: add compatibility with WeeChat >= 3.2 (XDG directories)
1 parent a58c980 commit c21cd4d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

python/cron.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright (C) 2010-2012 Sebastien Helleu <[email protected]>
3+
# Copyright (C) 2010-2021 Sébastien Helleu <[email protected]>
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License as published by
@@ -22,21 +22,23 @@
2222
#
2323
# History:
2424
#
25-
# 2012-01-03, Sebastien Helleu <[email protected]>:
25+
# 2021-05-02, Sébastien Helleu <[email protected]>:
26+
# version 0.5: add compatibility with WeeChat >= 3.2 (XDG directories)
27+
# 2012-01-03, Sébastien Helleu <[email protected]>:
2628
# version 0.4: make script compatible with Python 3.x
27-
# 2011-02-13, Sebastien Helleu <[email protected]>:
29+
# 2011-02-13, Sébastien Helleu <[email protected]>:
2830
# version 0.3: use new help format for command arguments
29-
# 2010-07-31, Sebastien Helleu <[email protected]>:
31+
# 2010-07-31, Sébastien Helleu <[email protected]>:
3032
# version 0.2: add keyword "commands" to run many commands
31-
# 2010-07-26, Sebastien Helleu <[email protected]>:
33+
# 2010-07-26, Sébastien Helleu <[email protected]>:
3234
# version 0.1: initial release
33-
# 2010-07-20, Sebastien Helleu <[email protected]>:
35+
# 2010-07-20, Sébastien Helleu <[email protected]>:
3436
# script creation
3537
#
3638

3739
SCRIPT_NAME = "cron"
38-
SCRIPT_AUTHOR = "Sebastien Helleu <[email protected]>"
39-
SCRIPT_VERSION = "0.4"
40+
SCRIPT_AUTHOR = "Sébastien Helleu <[email protected]>"
41+
SCRIPT_VERSION = "0.5"
4042
SCRIPT_LICENSE = "GPL3"
4143
SCRIPT_DESC = "Time-based scheduler, like cron and at"
4244

@@ -242,7 +244,11 @@ def exec_command(self, userExec=False):
242244

243245
def cron_filename():
244246
""" Get crontab filename. """
245-
return weechat.config_get_plugin("filename").replace("%h", weechat.info_get("weechat_dir", ""))
247+
options = {
248+
'directory': 'config',
249+
}
250+
return weechat.string_eval_path_home(
251+
weechat.config_get_plugin("filename"), {}, {}, options)
246252

247253
def cron_str_job_count(number):
248254
""" Get string with "%d jobs". """

0 commit comments

Comments
 (0)