Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
feat(config): ✨ add config file check
Browse files Browse the repository at this point in the history
  • Loading branch information
AnzhiZhang committed Jul 2, 2022
1 parent 10452ef commit 23bb19e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ def __init__(self):
super().__init__(CONFIG.DEFAULT)
self.save()

save_flag = False
for key, value in CONFIG.DEFAULT.items():
if key not in self.keys():
self[key] = value
save_flag = True
if save_flag:
self.save()

def save(self):
"""Save data"""
with open(CONFIG.FILE_PATH, 'w', encoding='utf-8') as f:
Expand Down

0 comments on commit 23bb19e

Please sign in to comment.