Files
anonymisation/gui_v6/fsutil.py
2026-06-29 19:15:28 +02:00

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