Skip to content

Commit f9af918

Browse files
committed
feat: gestion globale des preferences et creation auto des dossiers
- Deplacement des preferences globales vers ~/.PyCompiler_ARK avec logique de migration. - Creation automatique des dossiers 'engines' et 'Plugins' s'ils sont inexistants. - Unification des noms de dossiers en minuscules pour la coherence.
1 parent 8af3b1d commit f9af918

4 files changed

Lines changed: 21 additions & 7 deletions

File tree

Core/Auto_Command_Builder/auto_build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,12 +614,12 @@ def compute_for_all(
614614
ordered.append(e)
615615
except Exception:
616616
pass
617-
# 2) moteurs sous ENGINES/<engine_id>/mapping.json (plug-and-play)
617+
# 2) moteurs sous engines/<engine_id>/mapping.json (plug-and-play)
618618
try:
619619
project_root = os.path.abspath(
620620
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)
621621
)
622-
engines_root = os.path.join(project_root, "ENGINES")
622+
engines_root = os.path.join(project_root, "engines")
623623
if os.path.isdir(engines_root):
624624
for name in sorted(os.listdir(engines_root)):
625625
d = os.path.join(engines_root, name)

Loaders/EngineLoader/loader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,13 @@ def _discover_external_plugins(
134134

135135

136136
def _auto_discover() -> None:
137-
"""Discover and register external engine plugins from the project ENGINES folder."""
137+
"""Discover and register external engine plugins from the project engines folder."""
138138
base_dir = os.path.dirname(__file__)
139139
try:
140140
project_root = os.path.abspath(os.path.join(base_dir, os.pardir, os.pardir))
141141
external_dir = os.path.join(project_root, "engines")
142+
# Ensure directory exists for auto-discovery
143+
os.makedirs(external_dir, exist_ok=True)
142144
_discover_external_plugins(external_dir, namespace_package="engines")
143145
except Exception:
144146
logger.exception("Automatic engine discovery failed")

Ui/Cli/discovery.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ def _project_root() -> Path:
1111

1212

1313
def _plugins_root() -> Path:
14-
return _project_root() / "Plugins"
14+
path = _project_root() / "Plugins"
15+
try:
16+
path.mkdir(parents=True, exist_ok=True)
17+
except Exception:
18+
pass
19+
return path
1520

1621

1722
def _read_version_from_init(rel_path: str) -> str:
@@ -230,7 +235,7 @@ def bcasl_doctor_payload(workspace: str | None = None) -> dict[str, Any]:
230235
def scaffold_engine(target_name: str, root_dir: str | None = None) -> dict[str, Any]:
231236
safe = str(target_name).strip().replace("-", "_").replace(" ", "_").lower()
232237
base_root = Path(root_dir or Path.cwd())
233-
engine_dir = base_root / "ENGINES" / safe
238+
engine_dir = base_root / "engines" / safe
234239
lang_dir = engine_dir / "languages"
235240
created: list[str] = []
236241
if engine_dir.exists():

bcasl/Loader.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,16 @@ def _run_bcasl_sync(
321321

322322
def _get_plugins_dir() -> Path:
323323
try:
324-
return Path(__file__).resolve().parents[1] / "Plugins"
324+
path = Path(__file__).resolve().parents[1] / "Plugins"
325+
path.mkdir(parents=True, exist_ok=True)
326+
return path
325327
except Exception:
326-
return Path("Plugins")
328+
fallback = Path("Plugins")
329+
try:
330+
fallback.mkdir(parents=True, exist_ok=True)
331+
except Exception:
332+
pass
333+
return fallback
327334

328335

329336
def _resolve_ordered_plugin_ids(

0 commit comments

Comments
 (0)