35 lines
925 B
Python
35 lines
925 B
Python
__version__ = "0.2.1"
|
|
__author__ = "Alexander Kirchner"
|
|
__all__ = ["__version__", "__author__", "Icon", "settings"]
|
|
|
|
import os
|
|
|
|
from appdirs import AppDirs
|
|
|
|
from config import Config
|
|
|
|
|
|
app = AppDirs("SemesterApparatsManager", "SAM")
|
|
LOG_DIR = app.user_log_dir
|
|
CONFIG_DIR = app.user_config_dir
|
|
if not os.path.exists(LOG_DIR):
|
|
os.makedirs(LOG_DIR)
|
|
if not os.path.exists(CONFIG_DIR):
|
|
os.makedirs(CONFIG_DIR)
|
|
|
|
|
|
settings = Config(f"{CONFIG_DIR}/config.yaml")
|
|
DATABASE_DIR = (
|
|
app.user_config_dir if settings.database.path is None else settings.database.path
|
|
)
|
|
if not os.path.exists(DATABASE_DIR):
|
|
os.makedirs(DATABASE_DIR)
|
|
first_launch = settings.exists
|
|
if not os.path.exists(settings.database.temp.expanduser()):
|
|
settings.database.temp.expanduser().mkdir(parents=True, exist_ok=True)
|
|
from .utils.icon import Icon
|
|
|
|
if not os.path.exists("logs"):
|
|
os.mkdir("logs")
|
|
# open and close the file to create it
|