26 lines
728 B
Python
26 lines
728 B
Python
"""Ouverture du gestionnaire de fichiers sur un dossier (cross-plateforme).
|
|
|
|
Best-effort : ne lève jamais (un échec d'ouverture ne doit pas casser l'UI).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def open_in_file_manager(path) -> None:
|
|
"""Ouvre ``path`` dans l'explorateur de fichiers du système."""
|
|
target = str(Path(path))
|
|
try:
|
|
if sys.platform.startswith("win"):
|
|
import os
|
|
|
|
os.startfile(target) # type: ignore[attr-defined] # noqa: S606
|
|
elif sys.platform == "darwin":
|
|
subprocess.Popen(["open", target])
|
|
else:
|
|
subprocess.Popen(["xdg-open", target])
|
|
except Exception:
|
|
pass
|