From 78d07f005876cdfd3caf8144c455e8ae9ff77d76 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 4 Dec 2025 11:07:10 -0500 Subject: pke: actual exe path, child process launch tweaks --- editor/editor.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'editor/editor.cpp') diff --git a/editor/editor.cpp b/editor/editor.cpp index c1be34b..7400d5f 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -118,14 +118,22 @@ void PkeEditor_Tick(double delta) { subProgramPid = fork(); if (subProgramPid == 0) { int status = -1; - const char *argv[] = { - "pke-runtime", - "--plugin", pkeSettings.args.pluginPath == nullptr ? "libpke-example.o" : pkeSettings.args.pluginPath, - "--project", pkeSettings.args.projectPath == nullptr ? PKE_PROJ_DEFAULT_FILENAME : pkeSettings.args.projectPath, - "--scene", (editor_mstr.active_scene != nullptr && editor_mstr.active_scene->file_path.length > 0) ? editor_mstr.active_scene->file_path.val : PKE_PROJ_DEFAULT_FILENAME , - NULL, - }; - status = execvp("pke-runtime", const_cast(argv)); + std::vector args; + args.push_back(pkeSettings.executable_path); + if (pkeSettings.args.pluginPath != nullptr && strstr(pkeSettings.args.pluginPath, "libpke-editor") == nullptr) { + args.push_back("--plugin"); + args.push_back(pkeSettings.args.pluginPath); + } + if (pkeSettings.args.projectPath != nullptr) { + args.push_back("--project"); + args.push_back(pkeSettings.args.projectPath); + } + if (editor_mstr.active_scene != nullptr && editor_mstr.active_scene->file_path.length > 0) { + args.push_back("--scene"); + args.push_back(editor_mstr.active_scene->file_path.val); + } + args.push_back(NULL); + status = execvp(pkeSettings.executable_path, const_cast(&args[0])); fprintf(stderr, "pke-runtime (child) exited with a status of %i\n", status); subProgramPid = -1; } else if (subProgramPid == -1) { -- cgit v1.2.3