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