From a73314dc64021a17422ae01674f69e91371a044e Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Sat, 5 May 2018 23:44:35 +0800 Subject: [PATCH] make keyfile path relative to the config file --- nvchecker/core.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nvchecker/core.py b/nvchecker/core.py index 3b37f51..9399e75 100644 --- a/nvchecker/core.py +++ b/nvchecker/core.py @@ -114,17 +114,19 @@ class Source: if '__config__' in config: c = config['__config__'] + d = os.path.dirname(file.name) if 'oldver' in c and 'newver' in c: - d = os.path.dirname(file.name) self.oldver = os.path.expandvars(os.path.expanduser( os.path.join(d, c.get('oldver')))) self.newver = os.path.expandvars(os.path.expanduser( os.path.join(d, c.get('newver')))) - self.max_concurrent = c.getint('max_concurrent', 20) keyfile = c.get('keyfile') if keyfile: - keyfile = os.path.expanduser(keyfile) + keyfile = os.path.expandvars(os.path.expanduser( + os.path.join(d, c.get('keyfile')))) + + self.max_concurrent = c.getint('max_concurrent', 20) self.keymanager = KeyManager(keyfile) session.nv_config = config["__config__"]