migrate config file

This commit is contained in:
felinae98 2021-11-17 20:08:04 +08:00
parent afd689b23a
commit 60377d65d8
No known key found for this signature in database
GPG Key ID: 00C8B010587FF610

View File

@ -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