diff options
Diffstat (limited to 'editor/editor.cpp')
| -rw-r--r-- | editor/editor.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
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) { |
