HoYoCenter/app/env.py

18 lines
476 B
Python
Raw Normal View History

2024-09-09 13:29:53 +08:00
import platformdirs
import os
dirs = platformdirs.PlatformDirs("HoYoCenter")
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()
init()