# os_paths.py
#
# Project: AutoArchive
# License: GNU GPLv3
#
# Copyright (C) 2003 - 2026 Róbert Čerňanský



""":class:`OsPaths`."""



__all__ = ["OsPaths"]



import os

from AutoArchive._infrastructure.utils import Utils



class OsPaths:
    """Provides OS-specific paths"""

    __APP_NAME = "AutoArchive"
    __SHORT_APP_NAME = "aa"

    __WIN_APPDATA = os.path.join(os.getenv("APPDATA", default = os.path.expanduser("~")), __APP_NAME)



    @classmethod
    def getUserConfigDir(cls) -> str:
        if Utils.isWindows():
            return os.path.join(cls.__WIN_APPDATA, "config")
        else:
            xdgConfigHome = os.getenv("XDG_CONFIG_HOME", default = os.path.expanduser("~/.config"))
            return os.path.join(xdgConfigHome, cls.__SHORT_APP_NAME)



    @classmethod
    def getSystemConfigDir(cls) -> str:
        if Utils.isWindows():
            return os.path.join(os.getenv("ProgramData", default = r"C:\ProgramData"), cls.__APP_NAME)
        else:
            return os.path.join("/etc", cls.__SHORT_APP_NAME)



    @classmethod
    def getUserDataDir(cls) -> str:
        if Utils.isWindows():
            return os.path.join(cls.__WIN_APPDATA, "data")
        else:
            xdgDataHome = os.getenv("XDG_DATA_HOME", default = os.path.expanduser("~/.local/share"))
            return os.path.join(xdgDataHome, cls.__SHORT_APP_NAME)
