diff --git a/src/settings/config.py b/src/settings/config.py index ea09fee..b7b8fce 100644 --- a/src/settings/config.py +++ b/src/settings/config.py @@ -1,6 +1,4 @@ import json -import os -import tempfile import threading from typing import Optional @@ -120,13 +118,5 @@ class Config(): def __save(self) -> None: with self.__lock: - directory = os.path.dirname(os.path.abspath(self.__filename)) - fd, tmp_path = tempfile.mkstemp(dir=directory, suffix='.tmp') - try: - with os.fdopen(fd, 'w') as f: - json.dump(self.__config, f, ensure_ascii=False, indent=4) - os.replace(tmp_path, self.__filename) - except Exception: - if os.path.exists(tmp_path): - os.remove(tmp_path) - raise + with open(self.__filename, 'w', encoding='utf-8') as f: + json.dump(self.__config, f, ensure_ascii=False, indent=4)