summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-12-04 11:07:10 -0500
committerJonathan Bradley <jcb@pikum.xyz>2025-12-04 11:07:10 -0500
commit78d07f005876cdfd3caf8144c455e8ae9ff77d76 (patch)
tree59d79689214e9de46eda68d26e7040c91c33c178 /editor
parentc2d51783d5b9f17b4bbf624c33ba4ceb584aa4f5 (diff)
pke: actual exe path, child process launch tweaks
Diffstat (limited to 'editor')
-rw-r--r--editor/editor-main.cpp2
-rw-r--r--editor/editor.cpp24
2 files changed, 17 insertions, 9 deletions
diff --git a/editor/editor-main.cpp b/editor/editor-main.cpp
index 541e11f..15f9245 100644
--- a/editor/editor-main.cpp
+++ b/editor/editor-main.cpp
@@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
}
// run
PkeArgs_Parse(argc, argv);
- Game_Main({}, argv[0]);
+ Game_Main({});
pk_mem_bucket_destroy(bkt_editor);
fprintf(stdout, "PKE_EDITOR EXITING\n");
return 0;
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<char **>(argv));
+ std::vector<const char*> 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<char **>(&args[0]));
fprintf(stderr, "pke-runtime (child) exited with a status of %i\n", status);
subProgramPid = -1;
} else if (subProgramPid == -1) {