HoYoCenter/app/env.py

19 lines
520 B
Python
Raw Normal View History

2024-09-09 13:29:53 +08:00
import platformdirs
import os
from .config import Config
2024-09-09 13:29:53 +08:00
def init_dirs():
os.makedirs(dirs.user_config_path, exist_ok=True)
os.makedirs(dirs.user_log_path, exist_ok=True)
os.makedirs(dirs.user_data_path, exist_ok=True)
2024-09-09 15:03:46 +08:00
if not os.path.exists(os.path.join(dirs.user_config_path, "config.json")):
with open(os.path.join(dirs.user_config_path, "config.json"), "w") as f:
f.write("{}")
2024-09-09 13:29:53 +08:00
def init():
init_dirs()
dirs = platformdirs.PlatformDirs("HoYoCenter")
init()
config = Config()