MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / run

Method run

platform/linuxbsd/export/export_plugin.cpp:471–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471Error EditorExportPlatformLinuxBSD::run(const Ref<EditorExportPreset> &p_preset, int p_device, BitField<EditorExportPlatform::DebugFlags> p_debug_flags) {
472 cleanup();
473 if (p_device) { // Stop command, cleanup only.
474 return OK;
475 }
476
477 EditorProgress ep("run", TTR("Running..."), 5);
478
479 const String dest = EditorPaths::get_singleton()->get_temp_dir().path_join("linuxbsd");
480 Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
481 if (!da->dir_exists(dest)) {
482 Error err = da->make_dir_recursive(dest);
483 if (err != OK) {
484 EditorNode::get_singleton()->show_warning(TTR("Could not create temp directory:") + "\n" + dest);
485 return err;
486 }
487 }
488
489 String host = p_preset->get("ssh_remote_deploy/host").operator String();
490 String port = p_preset->get("ssh_remote_deploy/port").operator String();
491 if (port.is_empty()) {
492 port = "22";
493 }
494 Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ", false);
495 Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ", false);
496
497 const String basepath = dest.path_join("tmp_linuxbsd_export");
498
499#define CLEANUP_AND_RETURN(m_err) \
500 { \
501 if (da->file_exists(basepath + ".zip")) { \
502 da->remove(basepath + ".zip"); \
503 } \
504 if (da->file_exists(basepath + "_start.sh")) { \
505 da->remove(basepath + "_start.sh"); \
506 } \
507 if (da->file_exists(basepath + "_clean.sh")) { \
508 da->remove(basepath + "_clean.sh"); \
509 } \
510 return m_err; \
511 } \
512 ((void)0)
513
514 if (ep.step(TTR("Exporting project..."), 1)) {
515 return ERR_SKIP;
516 }
517 Error err = export_project(p_preset, true, basepath + ".zip", p_debug_flags);
518 if (err != OK) {
519 DirAccess::remove_file_or_error(basepath + ".zip");
520 return err;
521 }
522
523 String cmd_args;
524 {
525 Vector<String> cmd_args_list = gen_export_flags(p_debug_flags);
526 for (int i = 0; i < cmd_args_list.size(); i++) {
527 if (i != 0) {
528 cmd_args += " ";

Callers

nothing calls this directly

Calls 15

TTRFunction · 0.85
print_lineFunction · 0.85
vformatFunction · 0.85
path_joinMethod · 0.80
show_warningMethod · 0.80
splitMethod · 0.80
store_stringMethod · 0.80
SSHCleanupCommandClass · 0.70
sizeMethod · 0.65
createFunction · 0.50
get_temp_dirMethod · 0.45
dir_existsMethod · 0.45

Tested by

no test coverage detected