Skip to content

Commit 64336e8

Browse files
committed
amelio de lengin sdk
1 parent ad95f73 commit 64336e8

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

engine_sdk/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
build_env,
3131
clamp_text,
3232
ensure_dir,
33+
get_main_file_names,
3334
is_within_workspace,
3435
normalized_program_and_args,
3536
open_dir_candidates,
@@ -221,5 +222,6 @@ def check_engine_compatibility(engine_class, required_sdk_version: str = None) -
221222
"__version__",
222223
# Config helpers
223224
"save_engine_ui",
225+
"get_main_file_names",
224226
"__version__",
225227
]

engine_sdk/utils.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,3 +726,38 @@ def pip_install(
726726
pass
727727
code, _out, _err = run_process(gui, prog, args, timeout_ms=timeout_ms)
728728
return int(code)
729+
730+
731+
# -----------------------------------------------
732+
# ARK Configuration helpers
733+
# -----------------------------------------------
734+
735+
736+
def get_main_file_names(gui: Any) -> list[str]:
737+
"""Get main_file_names from the ARK configuration.
738+
739+
Attempts to load the ARK config from the workspace and extract the main_file_names list.
740+
Falls back to the default ["main.py", "app.py"] if the config cannot be loaded.
741+
742+
Args:
743+
gui: The GUI object (MainWindow) with workspace_dir attribute
744+
745+
Returns:
746+
List of main file names (e.g., ["main.py", "app.py"])
747+
"""
748+
try:
749+
from Core.ark_config_loader import load_ark_config
750+
751+
ws = getattr(gui, "workspace_dir", None)
752+
if not ws:
753+
return ["main.py", "app.py"]
754+
755+
ark_config = load_ark_config(ws)
756+
main_names = ark_config.get("main_file_names", ["main.py", "app.py"])
757+
758+
if isinstance(main_names, list):
759+
return [str(n) for n in main_names if n]
760+
761+
return ["main.py", "app.py"]
762+
except Exception:
763+
return ["main.py", "app.py"]

0 commit comments

Comments
 (0)