from __future__ import annotations

import os
import subprocess
import sys
from pathlib import Path


def open_path(path: Path) -> None:
    selected = path.resolve()
    if sys.platform == "win32":
        os.startfile(selected)  # type: ignore[attr-defined]
    elif sys.platform == "darwin":
        subprocess.Popen(["open", str(selected)])
    else:
        subprocess.Popen(["xdg-open", str(selected)])
