From 60377d65d878a4b55043ec7266b3b499a32e4448 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Wed, 17 Nov 2021 20:08:04 +0800 Subject: [PATCH] migrate config file --- src/plugins/nonebot_bison/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/nonebot_bison/config.py b/src/plugins/nonebot_bison/config.py index 29b734e..3434805 100644 --- a/src/plugins/nonebot_bison/config.py +++ b/src/plugins/nonebot_bison/config.py @@ -21,7 +21,11 @@ def get_config_path() -> str: data_dir = path.join(working_dir, 'data') if not path.isdir(data_dir): os.makedirs(data_dir) - return path.join(data_dir, 'bison.json') + old_path = path.join(data_dir, 'hk_reporter.json') + new_path = path.join(data_dir, 'bison.json') + if os.path.exists(old_path) and not os.path.exists(new_path): + os.rename(old_path, new_path) + return new_path class NoSuchUserException(Exception): pass