From 715206ea6ac5c743810aebb88a26995befc1524b Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Thu, 22 Feb 2024 18:51:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BA=AF=E5=B1=9E=E6=84=8F=E5=A4=96(?= =?UTF-8?q?=E7=A1=AE=E4=BF=A1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/config.py | 6 ++++-- common/variable.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/config.py b/common/config.py index 8ad7991..b1a417a 100644 --- a/common/config.py +++ b/common/config.py @@ -22,6 +22,8 @@ logger = log('config_manager') # 创建线程本地存储对象 local_data = threading.local() +if not os.path.exists('data'): + os.mkdir('data') def get_data_connection(): # 检查线程本地存储对象是否存在连接对象,如果不存在则创建一个新的连接对象 @@ -643,7 +645,7 @@ def initConfig(): variable.log_length_limit = read_config('common.log_length_limit') variable.debug_mode = read_config('common.debug_mode') logger.debug("配置文件加载成功") - conn = sqlite3.connect('cache.db') + conn = sqlite3.connect('./data/cache.db') # 创建一个游标对象 cursor = conn.cursor() @@ -657,7 +659,7 @@ data TEXT NOT NULL)''') conn.close() - conn2 = sqlite3.connect('data.db') + conn2 = sqlite3.connect('./data/data.db') # 创建一个游标对象 cursor2 = conn2.cursor() diff --git a/common/variable.py b/common/variable.py index 0b9c955..4c02183 100644 --- a/common/variable.py +++ b/common/variable.py @@ -12,7 +12,7 @@ import ujson as _json def _read_config_file(): try: - with open("./config.json", "r", encoding = "utf-8") as f: + with open("./data/config.json", "r", encoding = "utf-8") as f: return _json.load(f) except: pass