feat(gui): localiser les documents livrés + bouton ouvrir le dossier (P1-5)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
25
gui_v6/fsutil.py
Normal file
25
gui_v6/fsutil.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user