diff --git a/database/database.py b/database/database.py index 5ae1305..851bd2e 100644 --- a/database/database.py +++ b/database/database.py @@ -2,6 +2,7 @@ import math import os import re from contextlib import asynccontextmanager +from pathlib import Path import aiosqlite @@ -12,10 +13,9 @@ from ..config import g_sDBFilePath, g_sDBPath class CSqlManager: def __init__(self): - try: - os.mkdir(g_sDBFilePath) - except FileExistsError: - pass + dbPath = Path(g_sDBPath) + if dbPath and not dbPath.exists(): + os.makedirs(dbPath, exist_ok=True) @classmethod async def cleanup(cls): @@ -25,8 +25,7 @@ class CSqlManager: @classmethod async def init(cls) -> bool: try: - _ = os.path.exists(g_sDBFilePath) - cls.m_pDB = await aiosqlite.connect(str(g_sDBFilePath)) + cls.m_pDB = await aiosqlite.connect(g_sDBFilePath) cls.m_pDB.row_factory = aiosqlite.Row return True except Exception as e: diff --git a/resource/soil/浇水.png b/resource/soil/浇水.png new file mode 100644 index 0000000..d40b9f1 Binary files /dev/null and b/resource/soil/浇水.png differ diff --git a/resource/soil/浇水2.png b/resource/soil/浇水2.png new file mode 100644 index 0000000..6e69f28 Binary files /dev/null and b/resource/soil/浇水2.png differ diff --git a/resource/soil/紫色土地.png b/resource/soil/紫色土地.png new file mode 100644 index 0000000..800440a Binary files /dev/null and b/resource/soil/紫色土地.png differ diff --git a/resource/soil/红土缺水.png b/resource/soil/红土缺水.png new file mode 100644 index 0000000..24ba85e Binary files /dev/null and b/resource/soil/红土缺水.png differ diff --git a/resource/soil/红色土地.png b/resource/soil/红色土地.png new file mode 100644 index 0000000..7344aed Binary files /dev/null and b/resource/soil/红色土地.png differ diff --git a/resource/soil/肥沃土地.png b/resource/soil/肥沃土地.png new file mode 100644 index 0000000..e469f94 Binary files /dev/null and b/resource/soil/肥沃土地.png differ diff --git a/resource/soil/黄土 肥沃.png b/resource/soil/黄土 肥沃.png new file mode 100644 index 0000000..7e5e7c7 Binary files /dev/null and b/resource/soil/黄土 肥沃.png differ diff --git a/resource/soil/黄土缺水.png b/resource/soil/黄土缺水.png new file mode 100644 index 0000000..97d2344 Binary files /dev/null and b/resource/soil/黄土缺水.png differ diff --git a/resource/soil/黑土.png b/resource/soil/黑土.png new file mode 100644 index 0000000..f096f61 Binary files /dev/null and b/resource/soil/黑土.png differ