From 88a4105e7cbfbcd7952b3d47be3279f021f7ad6f Mon Sep 17 00:00:00 2001 From: Kyomotoi Date: Thu, 9 Jun 2022 22:32:12 +0800 Subject: =?UTF-8?q?=F0=9F=92=A9=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/essential.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ATRI/plugins/essential.py') diff --git a/ATRI/plugins/essential.py b/ATRI/plugins/essential.py index 37c18a4..763b137 100644 --- a/ATRI/plugins/essential.py +++ b/ATRI/plugins/essential.py @@ -1,4 +1,3 @@ -import os import json import shutil import asyncio @@ -44,9 +43,9 @@ bots = nonebot.get_bots() ESSENTIAL_DIR = Path(".") / "data" / "database" / "essential" MANEGE_DIR = Path(".") / "data" / "database" / "manege" TEMP_PATH = Path(".") / "data" / "temp" -os.makedirs(ESSENTIAL_DIR, exist_ok=True) -os.makedirs(MANEGE_DIR, exist_ok=True) -os.makedirs(TEMP_PATH, exist_ok=True) +ESSENTIAL_DIR.mkdir(parents=True, exist_ok=True) +MANEGE_DIR.mkdir(parents=True, exist_ok=True) +TEMP_PATH.mkdir(parents=True, exist_ok=True) @driver.on_startup @@ -368,7 +367,7 @@ async def _(): async def _clear_cache(): try: shutil.rmtree(TEMP_PATH) - os.makedirs(TEMP_PATH, exist_ok=True) + TEMP_PATH.mkdir(parents=True, exist_ok=True) except Exception: log.warning("清除缓存失败,请手动清除:data/temp") -- cgit v1.2.3