"""Application resource lookup that works in source and PyInstaller builds."""

from __future__ import annotations

from pathlib import Path
import sys

from PySide6.QtGui import QIcon


def resource_path(relative_path: str) -> Path:
    base = Path(
        getattr(sys, "_MEIPASS", Path(__file__).resolve().parents[1])
    )
    return base / relative_path


def application_icon() -> QIcon:
    return QIcon(str(resource_path("assets/musicgridstudio_icon.png")))
