Path: blob/master/platform/linuxbsd/export/export_plugin.cpp
10278 views
/**************************************************************************/1/* export_plugin.cpp */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#include "export_plugin.h"3132#include "logo_svg.gen.h"33#include "run_icon_svg.gen.h"3435#include "core/config/project_settings.h"36#include "editor/editor_node.h"37#include "editor/editor_string_names.h"38#include "editor/export/editor_export.h"39#include "editor/file_system/editor_paths.h"40#include "editor/themes/editor_scale.h"4142#include "modules/svg/image_loader_svg.h"4344Error EditorExportPlatformLinuxBSD::_export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path) {45Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::WRITE);46if (f.is_null()) {47add_message(EXPORT_MESSAGE_ERROR, TTR("Debug Script Export"), vformat(TTR("Could not open file \"%s\"."), p_path));48return ERR_CANT_CREATE;49}5051f->store_line("#!/bin/sh");52f->store_line("printf '\\033c\\033]0;%s\\a' " + p_app_name);53f->store_line("base_path=\"$(dirname \"$(realpath \"$0\")\")\"");54f->store_line("\"$base_path/" + p_pkg_name + "\" \"$@\"");5556return OK;57}5859Error EditorExportPlatformLinuxBSD::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, BitField<EditorExportPlatform::DebugFlags> p_flags) {60String custom_debug = p_preset->get("custom_template/debug");61String custom_release = p_preset->get("custom_template/release");62String arch = p_preset->get("binary_format/architecture");6364String template_path = p_debug ? custom_debug : custom_release;65template_path = template_path.strip_edges();66if (!template_path.is_empty()) {67String exe_arch = _get_exe_arch(template_path);68if (arch != exe_arch) {69add_message(EXPORT_MESSAGE_ERROR, TTR("Prepare Templates"), vformat(TTR("Mismatching custom export template executable architecture: found \"%s\", expected \"%s\"."), exe_arch, arch));70return ERR_CANT_CREATE;71}72}7374Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);75if (da->file_exists(template_path.get_base_dir().path_join("libaccesskit." + arch + ".so"))) {76da->copy(template_path.get_base_dir().path_join("libaccesskit." + arch + ".so"), p_path.get_base_dir().path_join("libaccesskit." + arch + ".so"), get_chmod_flags());77}7879bool export_as_zip = p_path.ends_with("zip");8081String pkg_name;82if (String(get_project_setting(p_preset, "application/config/name")) != "") {83pkg_name = String(get_project_setting(p_preset, "application/config/name"));84} else {85pkg_name = "Unnamed";86}8788pkg_name = OS::get_singleton()->get_safe_dir_name(pkg_name);8990// Setup temp folder.91String path = p_path;92String tmp_dir_path = EditorPaths::get_singleton()->get_temp_dir().path_join(pkg_name);9394Ref<DirAccess> tmp_app_dir = DirAccess::create_for_path(tmp_dir_path);95if (export_as_zip) {96if (tmp_app_dir.is_null()) {97add_message(EXPORT_MESSAGE_ERROR, TTR("Prepare Templates"), vformat(TTR("Could not create and open the directory: \"%s\""), tmp_dir_path));98return ERR_CANT_CREATE;99}100if (DirAccess::exists(tmp_dir_path)) {101if (tmp_app_dir->change_dir(tmp_dir_path) == OK) {102tmp_app_dir->erase_contents_recursive();103}104}105tmp_app_dir->make_dir_recursive(tmp_dir_path);106path = tmp_dir_path.path_join(p_path.get_file().get_basename());107}108109// Export project.110Error err = EditorExportPlatformPC::export_project(p_preset, p_debug, path, p_flags);111if (err != OK) {112// Message is supplied by the subroutine method.113return err;114}115116// Save console wrapper.117int con_scr = p_preset->get("debug/export_console_wrapper");118if ((con_scr == 1 && p_debug) || (con_scr == 2)) {119String scr_path = path.get_basename() + ".sh";120err = _export_debug_script(p_preset, pkg_name, path.get_file(), scr_path);121FileAccess::set_unix_permissions(scr_path, 0755);122if (err != OK) {123add_message(EXPORT_MESSAGE_ERROR, TTR("Debug Console Export"), TTR("Could not create console wrapper."));124}125}126127// ZIP project.128if (export_as_zip) {129if (FileAccess::exists(p_path)) {130OS::get_singleton()->move_to_trash(p_path);131}132133Ref<FileAccess> io_fa_dst;134zlib_filefunc_def io_dst = zipio_create_io(&io_fa_dst);135zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io_dst);136137zip_folder_recursive(zip, tmp_dir_path, "", pkg_name);138139zipClose(zip, nullptr);140141if (tmp_app_dir->change_dir(tmp_dir_path) == OK) {142tmp_app_dir->erase_contents_recursive();143tmp_app_dir->change_dir("..");144tmp_app_dir->remove(pkg_name);145}146}147148return err;149}150151String EditorExportPlatformLinuxBSD::get_template_file_name(const String &p_target, const String &p_arch) const {152return "linux_" + p_target + "." + p_arch;153}154155List<String> EditorExportPlatformLinuxBSD::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {156List<String> list;157list.push_back(p_preset->get("binary_format/architecture"));158list.push_back("zip");159160return list;161}162163bool EditorExportPlatformLinuxBSD::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const {164if (p_preset == nullptr) {165return true;166}167168bool advanced_options_enabled = p_preset->are_advanced_options_enabled();169170// Hide SSH options.171bool ssh = p_preset->get("ssh_remote_deploy/enabled");172if (!ssh && p_option != "ssh_remote_deploy/enabled" && p_option.begins_with("ssh_remote_deploy/")) {173return false;174}175if (p_option == "dotnet/embed_build_outputs" ||176p_option == "custom_template/debug" ||177p_option == "custom_template/release") {178return advanced_options_enabled;179}180return true;181}182183void EditorExportPlatformLinuxBSD::get_export_options(List<ExportOption> *r_options) const {184EditorExportPlatformPC::get_export_options(r_options);185186r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64,arm32,rv64,ppc64,loongarch64"), "x86_64"));187188String run_script = "#!/usr/bin/env bash\n"189"export DISPLAY=:0\n"190"unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"\n"191"\"{temp_dir}/{exe_name}\" {cmd_args}";192193String cleanup_script = "#!/usr/bin/env bash\n"194"kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")\n"195"rm -rf \"{temp_dir}\"";196197r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "ssh_remote_deploy/enabled"), false, true));198r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/host"), "user@host_ip"));199r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/port"), "22"));200201r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/extra_args_ssh", PROPERTY_HINT_MULTILINE_TEXT), ""));202r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/extra_args_scp", PROPERTY_HINT_MULTILINE_TEXT), ""));203r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/run_script", PROPERTY_HINT_MULTILINE_TEXT), run_script));204r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/cleanup_script", PROPERTY_HINT_MULTILINE_TEXT), cleanup_script));205}206207bool EditorExportPlatformLinuxBSD::is_elf(const String &p_path) const {208Ref<FileAccess> fb = FileAccess::open(p_path, FileAccess::READ);209ERR_FAIL_COND_V_MSG(fb.is_null(), false, vformat("Can't open file: \"%s\".", p_path));210uint32_t magic = fb->get_32();211return (magic == 0x464c457f);212}213214bool EditorExportPlatformLinuxBSD::is_shebang(const String &p_path) const {215Ref<FileAccess> fb = FileAccess::open(p_path, FileAccess::READ);216ERR_FAIL_COND_V_MSG(fb.is_null(), false, vformat("Can't open file: \"%s\".", p_path));217uint16_t magic = fb->get_16();218return (magic == 0x2123);219}220221bool EditorExportPlatformLinuxBSD::is_executable(const String &p_path) const {222return is_elf(p_path) || is_shebang(p_path);223}224225bool EditorExportPlatformLinuxBSD::has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const {226String err;227bool valid = EditorExportPlatformPC::has_valid_export_configuration(p_preset, err, r_missing_templates, p_debug);228229String custom_debug = p_preset->get("custom_template/debug").operator String().strip_edges();230String custom_release = p_preset->get("custom_template/release").operator String().strip_edges();231String arch = p_preset->get("binary_format/architecture");232233if (!custom_debug.is_empty() && FileAccess::exists(custom_debug)) {234String exe_arch = _get_exe_arch(custom_debug);235if (arch != exe_arch) {236err += vformat(TTR("Mismatching custom debug export template executable architecture: found \"%s\", expected \"%s\"."), exe_arch, arch) + "\n";237}238}239if (!custom_release.is_empty() && FileAccess::exists(custom_release)) {240String exe_arch = _get_exe_arch(custom_release);241if (arch != exe_arch) {242err += vformat(TTR("Mismatching custom release export template executable architecture: found \"%s\", expected \"%s\"."), exe_arch, arch) + "\n";243}244}245246if (!err.is_empty()) {247r_error = err;248}249250return valid;251}252253String EditorExportPlatformLinuxBSD::_get_exe_arch(const String &p_path) const {254Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);255if (f.is_null()) {256return "invalid";257}258259// Read and check ELF magic number.260{261uint32_t magic = f->get_32();262if (magic != 0x464c457f) { // 0x7F + "ELF"263return "invalid";264}265}266267// Process header.268int64_t header_pos = f->get_position();269f->seek(header_pos + 14);270uint16_t machine = f->get_16();271f->close();272273switch (machine) {274case 0x0003:275return "x86_32";276case 0x003e:277return "x86_64";278case 0x0015:279return "ppc64";280case 0x0028:281return "arm32";282case 0x00b7:283return "arm64";284case 0x00f3:285return "rv64";286case 0x0102:287return "loongarch64";288default:289return "unknown";290}291}292293Error EditorExportPlatformLinuxBSD::fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) {294// Patch the header of the "pck" section in the ELF file so that it corresponds to the embedded data.295296Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ_WRITE);297if (f.is_null()) {298add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), vformat(TTR("Failed to open executable file \"%s\"."), p_path));299return ERR_CANT_OPEN;300}301302// Read and check ELF magic number.303{304uint32_t magic = f->get_32();305if (magic != 0x464c457f) { // 0x7F + "ELF"306add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("Executable file header corrupted."));307return ERR_FILE_CORRUPT;308}309}310311// Read program architecture bits from class field.312313int bits = f->get_8() * 32;314315if (bits == 32 && p_embedded_size >= 0x100000000) {316add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("32-bit executables cannot have embedded data >= 4 GiB."));317}318319// Get info about the section header table.320321int64_t section_table_pos;322int64_t section_header_size;323if (bits == 32) {324section_header_size = 40;325f->seek(0x20);326section_table_pos = f->get_32();327f->seek(0x30);328} else { // 64329section_header_size = 64;330f->seek(0x28);331section_table_pos = f->get_64();332f->seek(0x3c);333}334int num_sections = f->get_16();335int string_section_idx = f->get_16();336337// Load the strings table.338uint8_t *strings;339{340// Jump to the strings section header.341f->seek(section_table_pos + string_section_idx * section_header_size);342343// Read strings data size and offset.344int64_t string_data_pos;345int64_t string_data_size;346if (bits == 32) {347f->seek(f->get_position() + 0x10);348string_data_pos = f->get_32();349string_data_size = f->get_32();350} else { // 64351f->seek(f->get_position() + 0x18);352string_data_pos = f->get_64();353string_data_size = f->get_64();354}355356// Read strings data.357f->seek(string_data_pos);358strings = (uint8_t *)memalloc(string_data_size);359if (!strings) {360return ERR_OUT_OF_MEMORY;361}362f->get_buffer(strings, string_data_size);363}364365// Search for the "pck" section.366367bool found = false;368for (int i = 0; i < num_sections; ++i) {369int64_t section_header_pos = section_table_pos + i * section_header_size;370f->seek(section_header_pos);371372uint32_t name_offset = f->get_32();373if (strcmp((char *)strings + name_offset, "pck") == 0) {374// "pck" section found, let's patch!375376if (bits == 32) {377f->seek(section_header_pos + 0x10);378f->store_32(p_embedded_start);379f->store_32(p_embedded_size);380} else { // 64381f->seek(section_header_pos + 0x18);382f->store_64(p_embedded_start);383f->store_64(p_embedded_size);384}385386found = true;387break;388}389}390391memfree(strings);392393if (!found) {394add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("Executable \"pck\" section not found."));395return ERR_FILE_CORRUPT;396}397return OK;398}399400Ref<Texture2D> EditorExportPlatformLinuxBSD::get_run_icon() const {401return run_icon;402}403404bool EditorExportPlatformLinuxBSD::poll_export() {405Ref<EditorExportPreset> preset;406407for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {408Ref<EditorExportPreset> ep = EditorExport::get_singleton()->get_export_preset(i);409if (ep->is_runnable() && ep->get_platform() == this) {410preset = ep;411break;412}413}414415int prev = menu_options;416menu_options = (preset.is_valid() && preset->get("ssh_remote_deploy/enabled").operator bool());417if (ssh_pid != 0 || !cleanup_commands.is_empty()) {418if (menu_options == 0) {419cleanup();420} else {421menu_options += 1;422}423}424return menu_options != prev;425}426427Ref<Texture2D> EditorExportPlatformLinuxBSD::get_option_icon(int p_index) const {428if (p_index == 1) {429return stop_icon;430} else {431return EditorExportPlatform::get_option_icon(p_index);432}433}434435int EditorExportPlatformLinuxBSD::get_options_count() const {436return menu_options;437}438439String EditorExportPlatformLinuxBSD::get_option_label(int p_index) const {440return (p_index) ? TTR("Stop and uninstall") : TTR("Run on remote Linux/BSD system");441}442443String EditorExportPlatformLinuxBSD::get_option_tooltip(int p_index) const {444return (p_index) ? TTR("Stop and uninstall running project from the remote system") : TTR("Run exported project on remote Linux/BSD system");445}446447void EditorExportPlatformLinuxBSD::cleanup() {448if (ssh_pid != 0 && OS::get_singleton()->is_process_running(ssh_pid)) {449print_line("Terminating connection...");450OS::get_singleton()->kill(ssh_pid);451OS::get_singleton()->delay_usec(1000);452}453454if (!cleanup_commands.is_empty()) {455print_line("Stopping and deleting previous version...");456for (const SSHCleanupCommand &cmd : cleanup_commands) {457if (cmd.wait) {458ssh_run_on_remote(cmd.host, cmd.port, cmd.ssh_args, cmd.cmd_args);459} else {460ssh_run_on_remote_no_wait(cmd.host, cmd.port, cmd.ssh_args, cmd.cmd_args);461}462}463}464ssh_pid = 0;465cleanup_commands.clear();466}467468Error EditorExportPlatformLinuxBSD::run(const Ref<EditorExportPreset> &p_preset, int p_device, BitField<EditorExportPlatform::DebugFlags> p_debug_flags) {469cleanup();470if (p_device) { // Stop command, cleanup only.471return OK;472}473474EditorProgress ep("run", TTR("Running..."), 5);475476const String dest = EditorPaths::get_singleton()->get_temp_dir().path_join("linuxbsd");477Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);478if (!da->dir_exists(dest)) {479Error err = da->make_dir_recursive(dest);480if (err != OK) {481EditorNode::get_singleton()->show_warning(TTR("Could not create temp directory:") + "\n" + dest);482return err;483}484}485486String host = p_preset->get("ssh_remote_deploy/host").operator String();487String port = p_preset->get("ssh_remote_deploy/port").operator String();488if (port.is_empty()) {489port = "22";490}491Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ", false);492Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ", false);493494const String basepath = dest.path_join("tmp_linuxbsd_export");495496#define CLEANUP_AND_RETURN(m_err) \497{ \498if (da->file_exists(basepath + ".zip")) { \499da->remove(basepath + ".zip"); \500} \501if (da->file_exists(basepath + "_start.sh")) { \502da->remove(basepath + "_start.sh"); \503} \504if (da->file_exists(basepath + "_clean.sh")) { \505da->remove(basepath + "_clean.sh"); \506} \507return m_err; \508} \509((void)0)510511if (ep.step(TTR("Exporting project..."), 1)) {512return ERR_SKIP;513}514Error err = export_project(p_preset, true, basepath + ".zip", p_debug_flags);515if (err != OK) {516DirAccess::remove_file_or_error(basepath + ".zip");517return err;518}519520String cmd_args;521{522Vector<String> cmd_args_list = gen_export_flags(p_debug_flags);523for (int i = 0; i < cmd_args_list.size(); i++) {524if (i != 0) {525cmd_args += " ";526}527cmd_args += cmd_args_list[i];528}529}530531const bool use_remote = p_debug_flags.has_flag(DEBUG_FLAG_REMOTE_DEBUG) || p_debug_flags.has_flag(DEBUG_FLAG_DUMB_CLIENT);532int dbg_port = EDITOR_GET("network/debug/remote_port");533534print_line("Creating temporary directory...");535ep.step(TTR("Creating temporary directory..."), 2);536String temp_dir;537err = ssh_run_on_remote(host, port, extra_args_ssh, "mktemp -d", &temp_dir);538if (err != OK || temp_dir.is_empty()) {539CLEANUP_AND_RETURN(err);540}541542print_line("Uploading archive...");543ep.step(TTR("Uploading archive..."), 3);544err = ssh_push_to_remote(host, port, extra_args_scp, basepath + ".zip", temp_dir);545if (err != OK) {546CLEANUP_AND_RETURN(err);547}548549{550String run_script = p_preset->get("ssh_remote_deploy/run_script");551run_script = run_script.replace("{temp_dir}", temp_dir);552run_script = run_script.replace("{archive_name}", basepath.get_file() + ".zip");553run_script = run_script.replace("{exe_name}", basepath.get_file());554run_script = run_script.replace("{cmd_args}", cmd_args);555556Ref<FileAccess> f = FileAccess::open(basepath + "_start.sh", FileAccess::WRITE);557if (f.is_null()) {558CLEANUP_AND_RETURN(err);559}560561f->store_string(run_script);562}563564{565String clean_script = p_preset->get("ssh_remote_deploy/cleanup_script");566clean_script = clean_script.replace("{temp_dir}", temp_dir);567clean_script = clean_script.replace("{archive_name}", basepath.get_file() + ".zip");568clean_script = clean_script.replace("{exe_name}", basepath.get_file());569clean_script = clean_script.replace("{cmd_args}", cmd_args);570571Ref<FileAccess> f = FileAccess::open(basepath + "_clean.sh", FileAccess::WRITE);572if (f.is_null()) {573CLEANUP_AND_RETURN(err);574}575576f->store_string(clean_script);577}578579print_line("Uploading scripts...");580ep.step(TTR("Uploading scripts..."), 4);581err = ssh_push_to_remote(host, port, extra_args_scp, basepath + "_start.sh", temp_dir);582if (err != OK) {583CLEANUP_AND_RETURN(err);584}585err = ssh_run_on_remote(host, port, extra_args_ssh, vformat("chmod +x \"%s/%s\"", temp_dir, basepath.get_file() + "_start.sh"));586if (err != OK || temp_dir.is_empty()) {587CLEANUP_AND_RETURN(err);588}589err = ssh_push_to_remote(host, port, extra_args_scp, basepath + "_clean.sh", temp_dir);590if (err != OK) {591CLEANUP_AND_RETURN(err);592}593err = ssh_run_on_remote(host, port, extra_args_ssh, vformat("chmod +x \"%s/%s\"", temp_dir, basepath.get_file() + "_clean.sh"));594if (err != OK || temp_dir.is_empty()) {595CLEANUP_AND_RETURN(err);596}597598print_line("Starting project...");599ep.step(TTR("Starting project..."), 5);600err = ssh_run_on_remote_no_wait(host, port, extra_args_ssh, vformat("\"%s/%s\"", temp_dir, basepath.get_file() + "_start.sh"), &ssh_pid, (use_remote) ? dbg_port : -1);601if (err != OK) {602CLEANUP_AND_RETURN(err);603}604605cleanup_commands.clear();606cleanup_commands.push_back(SSHCleanupCommand(host, port, extra_args_ssh, vformat("\"%s/%s\"", temp_dir, basepath.get_file() + "_clean.sh")));607608print_line("Project started.");609610CLEANUP_AND_RETURN(OK);611#undef CLEANUP_AND_RETURN612}613614EditorExportPlatformLinuxBSD::EditorExportPlatformLinuxBSD() {615if (EditorNode::get_singleton()) {616Ref<Image> img = memnew(Image);617const bool upsample = !Math::is_equal_approx(Math::round(EDSCALE), EDSCALE);618619ImageLoaderSVG::create_image_from_string(img, _linuxbsd_logo_svg, EDSCALE, upsample, false);620set_logo(ImageTexture::create_from_image(img));621622ImageLoaderSVG::create_image_from_string(img, _linuxbsd_run_icon_svg, EDSCALE, upsample, false);623run_icon = ImageTexture::create_from_image(img);624625Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme();626if (theme.is_valid()) {627stop_icon = theme->get_icon(SNAME("Stop"), EditorStringName(EditorIcons));628} else {629stop_icon.instantiate();630}631}632}633634635