Skip to content

Commit a651e58

Browse files
committed
Fix: résolution correcte du chemin du dossier de sortie pour l'ouverture automatique
1 parent c67d156 commit a651e58

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Core/engine/base.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,36 @@ def on_success(self, gui, file: str) -> None:
117117
"""Hook called when a build is successful."""
118118
pass
119119

120+
def open_output_dir(self, output_dir: str) -> None:
121+
"""Open the output directory with the default system handler."""
122+
if not output_dir:
123+
return
124+
125+
import os
126+
127+
from engine_sdk.utils import log_with_level, open_path
128+
129+
path = output_dir
130+
if not os.path.isabs(path):
131+
# Try to find workspace_dir to resolve relative path
132+
ws = getattr(self, "workspace_dir", None)
133+
if not ws and hasattr(self, "_gui"):
134+
ws = getattr(self._gui, "workspace_dir", None)
135+
136+
if ws:
137+
path = os.path.join(ws, path)
138+
else:
139+
path = os.path.abspath(path)
140+
141+
if os.path.isdir(path):
142+
# Log attempt to open
143+
gui = getattr(self, "_gui", None)
144+
if gui:
145+
log_with_level(
146+
gui, "info", f"Ouverture du dossier de sortie : {path}"
147+
)
148+
open_path(path)
149+
120150
def engine_translate(self, key: str, default: Optional[str] = None) -> str:
121151
"""Translate an engine-local key using the shared engine i18n registry."""
122152
try:

0 commit comments

Comments
 (0)