#!/usr/bin/python3 import os import subprocess from pathlib import Path from fungus.logger import get_logger from fungus.path_manager import PathManager log = get_logger(__name__) fungus_version = "@VERSION@-@RELEASE@" def get_desktop_dir(): try: return subprocess.check_output(['xdg-user-dir', 'DESKTOP'], text=True).strip() except (FileNotFoundError, subprocess.CalledProcessError): log.warning("xdg-user-dir not found or failed; falling back to ~/Desktop") return str(Path.home() / 'Desktop') # ── User config / data paths ──────────────────────────────────────────── fungus_launcher_dir = PathManager.user_config('fungus-launcher') icons_dir = PathManager.user_config('fungus-launcher/icons') config_file_path = PathManager.user_config('fungus-launcher/config.ini') share_dir = PathManager.user_data() app_dir = PathManager.user_data('applications') fungus_png = PathManager.get_icon('fungus-launcher.png') # ── Binary / runtime paths ────────────────────────────────────────────── fungus_run = PathManager.find_binary('fungus-run') fungus_proton_manager = PathManager.find_binary('fungus-proton-manager') umu_run = PathManager.user_data('fungus-launcher/umu-run') games_dir = PathManager.user_config('fungus-launcher/games') games_json = PathManager.user_config('fungus-launcher/games.json') prefixes_dir = PathManager.user_config('fungus-launcher/prefixes') fungus_launcher_share_dir = PathManager.user_data('fungus-launcher') # ── Computed paths ───────────────────────────────────────────────────── desktop_dir = get_desktop_dir() # ── Flags & defaults ──────────────────────────────────────────────────── fungus_backup = False # ── Ensure required directories exist ─────────────────────────────────── os.makedirs(fungus_launcher_share_dir, exist_ok=True) os.makedirs(fungus_launcher_dir, exist_ok=True) os.makedirs(prefixes_dir, exist_ok=True)