Path: blob/master/platform/linuxbsd/export/export_plugin.cpp
20937 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 "core/io/dir_access.h"37#include "editor/editor_node.h"38#include "editor/editor_string_names.h"39#include "editor/export/editor_export.h"40#include "editor/file_system/editor_paths.h"41#include "editor/themes/editor_scale.h"4243#include "modules/svg/image_loader_svg.h"4445Error EditorExportPlatformLinuxBSD::_export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path) {46Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::WRITE);47if (f.is_null()) {48add_message(EXPORT_MESSAGE_ERROR, TTR("Debug Script Export"), vformat(TTR("Could not open file \"%s\"."), p_path));49return ERR_CANT_CREATE;50}5152f->store_line("#!/bin/sh");53f->store_line("printf '\\033c\\033]0;%s\\a' " + p_app_name);54f->store_line("base_path=\"$(dirname \"$(realpath \"$0\")\")\"");55f->store_line("\"$base_path/" + p_pkg_name + "\" \"$@\"");5657return OK;58}5960Error EditorExportPlatformLinuxBSD::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, BitField<EditorExportPlatform::DebugFlags> p_flags) {61String custom_debug = p_preset->get("custom_template/debug");62String custom_release = p_preset->get("custom_template/release");63String arch = p_preset->get("binary_format/architecture");6465String template_path = p_debug ? custom_debug : custom_release;66template_path = template_path.strip_edges();67if (!template_path.is_empty()) {68String exe_arch = _get_exe_arch(template_path);69if (arch != exe_arch) {70add_message(EXPORT_MESSAGE_ERROR, TTR("Prepare Templates"), vformat(TTR("Mismatching custom export template executable architecture: found \"%s\", expected \"%s\"."), exe_arch, arch));71return ERR_CANT_CREATE;72}73}7475Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);76if (da->file_exists(template_path.get_base_dir().path_join("libaccesskit." + arch + ".so"))) {77da->copy(template_path.get_base_dir().path_join("libaccesskit." + arch + ".so"), p_path.get_base_dir().path_join("libaccesskit." + arch + ".so"), get_chmod_flags());78}7980bool export_as_zip = p_path.ends_with("zip");8182String pkg_name;83if (String(get_project_setting(p_preset, "application/config/name")) != "") {84pkg_name = String(get_project_setting(p_preset, "application/config/name"));85} else {86pkg_name = "Unnamed";87}8889pkg_name = OS::get_singleton()->get_safe_dir_name(pkg_name);9091// Setup temp folder.92String path = p_path;93String tmp_dir_path = EditorPaths::get_singleton()->get_temp_dir().path_join(pkg_name);9495Ref<DirAccess> tmp_app_dir = DirAccess::create_for_path(tmp_dir_path);96if (export_as_zip) {97if (tmp_app_dir.is_null()) {98add_message(EXPORT_MESSAGE_ERROR, TTR("Prepare Templates"), vformat(TTR("Could not create and open the directory: \"%s\""), tmp_dir_path));99return ERR_CANT_CREATE;100}101if (DirAccess::exists(tmp_dir_path)) {102if (tmp_app_dir->change_dir(tmp_dir_path) == OK) {103tmp_app_dir->erase_contents_recursive();104}105}106tmp_app_dir->make_dir_recursive(tmp_dir_path);107path = tmp_dir_path.path_join(p_path.get_file().get_basename());108}109110// Export project.111Error err = EditorExportPlatformPC::export_project(p_preset, p_debug, path, p_flags);112if (err != OK) {113// Message is supplied by the subroutine method.114return err;115}116117// Save console wrapper.118int con_scr = p_preset->get("debug/export_console_wrapper");119if ((con_scr == 1 && p_debug) || (con_scr == 2)) {120String scr_path = path.get_basename() + ".sh";121err = _export_debug_script(p_preset, pkg_name, path.get_file(), scr_path);122FileAccess::set_unix_permissions(scr_path, 0755);123if (err != OK) {124add_message(EXPORT_MESSAGE_ERROR, TTR("Debug Console Export"), TTR("Could not create console wrapper."));125}126}127128// ZIP project.129if (export_as_zip) {130if (FileAccess::exists(p_path)) {131OS::get_singleton()->move_to_trash(p_path);132}133134Ref<FileAccess> io_fa_dst;135zlib_filefunc_def io_dst = zipio_create_io(&io_fa_dst);136zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io_dst);137138zip_folder_recursive(zip, tmp_dir_path, "", pkg_name);139140zipClose(zip, nullptr);141142if (tmp_app_dir->change_dir(tmp_dir_path) == OK) {143tmp_app_dir->erase_contents_recursive();144tmp_app_dir->change_dir("..");145tmp_app_dir->remove(pkg_name);146}147}148149return err;150}151152String EditorExportPlatformLinuxBSD::get_template_file_name(const String &p_target, const String &p_arch) const {153return "linux_" + p_target + "." + p_arch;154}155156List<String> EditorExportPlatformLinuxBSD::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {157List<String> list;158list.push_back(p_preset->get("binary_format/architecture"));159list.push_back("zip");160161return list;162}163164bool EditorExportPlatformLinuxBSD::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const {165if (p_preset == nullptr) {166return true;167}168169bool advanced_options_enabled = p_preset->are_advanced_options_enabled();170171// Hide SSH options.172bool ssh = p_preset->get("ssh_remote_deploy/enabled");173if (!ssh && p_option != "ssh_remote_deploy/enabled" && p_option.begins_with("ssh_remote_deploy/")) {174return false;175}176if (p_option == "dotnet/embed_build_outputs" ||177p_option == "custom_template/debug" ||178p_option == "custom_template/release") {179return advanced_options_enabled;180}181return true;182}183184void EditorExportPlatformLinuxBSD::get_export_options(List<ExportOption> *r_options) const {185EditorExportPlatformPC::get_export_options(r_options);186187r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64,arm32,rv64,ppc64,loongarch64"), "x86_64"));188189String run_script = "#!/usr/bin/env bash\n"190"export DISPLAY=:0\n"191"unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"\n"192"\"{temp_dir}/{exe_name}\" {cmd_args}";193194String cleanup_script = "#!/usr/bin/env bash\n"195"pkill -x -f \"{temp_dir}/{exe_name} {cmd_args}\"\n"196"rm -rf \"{temp_dir}\"";197198r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "ssh_remote_deploy/enabled"), false, true));199r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/host"), "user@host_ip"));200r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/port"), "22"));201202r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/extra_args_ssh", PROPERTY_HINT_MULTILINE_TEXT, "monospace,no_wrap"), ""));203r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/extra_args_scp", PROPERTY_HINT_MULTILINE_TEXT, "monospace,no_wrap"), ""));204r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/run_script", PROPERTY_HINT_MULTILINE_TEXT, "monospace,no_wrap"), run_script));205r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/cleanup_script", PROPERTY_HINT_MULTILINE_TEXT, "monospace,no_wrap"), cleanup_script));206}207208bool EditorExportPlatformLinuxBSD::is_elf(const String &p_path) const {209Ref<FileAccess> fb = FileAccess::open(p_path, FileAccess::READ);210ERR_FAIL_COND_V_MSG(fb.is_null(), false, vformat("Can't open file: \"%s\".", p_path));211uint32_t magic = fb->get_32();212return (magic == 0x464c457f);213}214215bool EditorExportPlatformLinuxBSD::is_shebang(const String &p_path) const {216Ref<FileAccess> fb = FileAccess::open(p_path, FileAccess::READ);217ERR_FAIL_COND_V_MSG(fb.is_null(), false, vformat("Can't open file: \"%s\".", p_path));218uint16_t magic = fb->get_16();219return (magic == 0x2123);220}221222bool EditorExportPlatformLinuxBSD::is_executable(const String &p_path) const {223return is_elf(p_path) || is_shebang(p_path);224}225226bool EditorExportPlatformLinuxBSD::has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const {227String err;228bool valid = EditorExportPlatformPC::has_valid_export_configuration(p_preset, err, r_missing_templates, p_debug);229230String custom_debug = p_preset->get("custom_template/debug").operator String().strip_edges();231String custom_release = p_preset->get("custom_template/release").operator String().strip_edges();232String arch = p_preset->get("binary_format/architecture");233234if (!custom_debug.is_empty() && FileAccess::exists(custom_debug)) {235String exe_arch = _get_exe_arch(custom_debug);236if (arch != exe_arch) {237err += vformat(TTR("Mismatching custom debug export template executable architecture: found \"%s\", expected \"%s\"."), exe_arch, arch) + "\n";238}239}240if (!custom_release.is_empty() && FileAccess::exists(custom_release)) {241String exe_arch = _get_exe_arch(custom_release);242if (arch != exe_arch) {243err += vformat(TTR("Mismatching custom release export template executable architecture: found \"%s\", expected \"%s\"."), exe_arch, arch) + "\n";244}245}246247if (!err.is_empty()) {248r_error = err;249}250251return valid;252}253254String EditorExportPlatformLinuxBSD::_get_exe_arch(const String &p_path) const {255Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);256if (f.is_null()) {257return "invalid";258}259260// Read and check ELF magic number.261{262uint32_t magic = f->get_32();263if (magic != 0x464c457f) { // 0x7F + "ELF"264return "invalid";265}266}267268// Process header.269int64_t header_pos = f->get_position();270f->seek(header_pos + 14);271uint16_t machine = f->get_16();272f->close();273274switch (machine) {275case 0x0003:276return "x86_32";277case 0x003e:278return "x86_64";279case 0x0015:280return "ppc64";281case 0x0028:282return "arm32";283case 0x00b7:284return "arm64";285case 0x00f3:286return "rv64";287case 0x0102:288return "loongarch64";289default:290return "unknown";291}292}293294Error EditorExportPlatformLinuxBSD::fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) {295// Patch the header of the "pck" section in the ELF file so that it corresponds to the embedded data.296297Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ_WRITE);298if (f.is_null()) {299add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), vformat(TTR("Failed to open executable file \"%s\"."), p_path));300return ERR_CANT_OPEN;301}302303// Read and check ELF magic number.304{305uint32_t magic = f->get_32();306if (magic != 0x464c457f) { // 0x7F + "ELF"307add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("Executable file header corrupted."));308return ERR_FILE_CORRUPT;309}310}311312// Read program architecture bits from class field.313314int bits = f->get_8() * 32;315316if (bits == 32 && p_embedded_size >= 0x100000000) {317add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("32-bit executables cannot have embedded data >= 4 GiB."));318}319320// Get info about the section header table.321322int64_t section_table_pos;323int64_t section_header_size;324if (bits == 32) {325section_header_size = 40;326f->seek(0x20);327section_table_pos = f->get_32();328f->seek(0x30);329} else { // 64330section_header_size = 64;331f->seek(0x28);332section_table_pos = f->get_64();333f->seek(0x3c);334}335int num_sections = f->get_16();336int string_section_idx = f->get_16();337338// Load the strings table.339uint8_t *strings;340{341// Jump to the strings section header.342f->seek(section_table_pos + string_section_idx * section_header_size);343344// Read strings data size and offset.345int64_t string_data_pos;346int64_t string_data_size;347if (bits == 32) {348f->seek(f->get_position() + 0x10);349string_data_pos = f->get_32();350string_data_size = f->get_32();351} else { // 64352f->seek(f->get_position() + 0x18);353string_data_pos = f->get_64();354string_data_size = f->get_64();355}356357// Read strings data.358f->seek(string_data_pos);359strings = (uint8_t *)memalloc(string_data_size);360if (!strings) {361return ERR_OUT_OF_MEMORY;362}363f->get_buffer(strings, string_data_size);364}365366// Search for the "pck" section.367368bool found = false;369for (int i = 0; i < num_sections; ++i) {370int64_t section_header_pos = section_table_pos + i * section_header_size;371f->seek(section_header_pos);372373uint32_t name_offset = f->get_32();374if (strcmp((char *)strings + name_offset, "pck") == 0) {375// "pck" section found, let's patch!376377if (bits == 32) {378f->seek(section_header_pos + 0x10);379f->store_32(p_embedded_start);380f->store_32(p_embedded_size);381} else { // 64382f->seek(section_header_pos + 0x18);383f->store_64(p_embedded_start);384f->store_64(p_embedded_size);385}386387found = true;388break;389}390}391392memfree(strings);393394if (!found) {395add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("Executable \"pck\" section not found."));396return ERR_FILE_CORRUPT;397}398return OK;399}400401Ref<Texture2D> EditorExportPlatformLinuxBSD::get_run_icon() const {402return run_icon;403}404405bool EditorExportPlatformLinuxBSD::poll_export() {406Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_runnable_preset_for_platform(this);407408int prev = menu_options;409menu_options = (preset.is_valid() && preset->get("ssh_remote_deploy/enabled").operator bool());410if (ssh_pid != 0 || !cleanup_commands.is_empty()) {411if (menu_options == 0) {412cleanup();413} else {414menu_options += 1;415}416}417return menu_options != prev;418}419420Ref<Texture2D> EditorExportPlatformLinuxBSD::get_option_icon(int p_index) const {421if (p_index == 1) {422return stop_icon;423} else {424return EditorExportPlatform::get_option_icon(p_index);425}426}427428int EditorExportPlatformLinuxBSD::get_options_count() const {429return menu_options;430}431432String EditorExportPlatformLinuxBSD::get_option_label(int p_index) const {433return (p_index) ? TTR("Stop and uninstall") : TTR("Run on remote Linux/BSD system");434}435436String EditorExportPlatformLinuxBSD::get_option_tooltip(int p_index) const {437return (p_index) ? TTR("Stop and uninstall running project from the remote system") : TTR("Run exported project on remote Linux/BSD system");438}439440void EditorExportPlatformLinuxBSD::cleanup() {441if (ssh_pid != 0 && OS::get_singleton()->is_process_running(ssh_pid)) {442print_line("Terminating connection...");443OS::get_singleton()->kill(ssh_pid);444OS::get_singleton()->delay_usec(1000);445}446447if (!cleanup_commands.is_empty()) {448print_line("Stopping and deleting previous version...");449for (const SSHCleanupCommand &cmd : cleanup_commands) {450if (cmd.wait) {451ssh_run_on_remote(cmd.host, cmd.port, cmd.ssh_args, cmd.cmd_args);452} else {453ssh_run_on_remote_no_wait(cmd.host, cmd.port, cmd.ssh_args, cmd.cmd_args);454}455}456}457ssh_pid = 0;458cleanup_commands.clear();459}460461Error EditorExportPlatformLinuxBSD::run(const Ref<EditorExportPreset> &p_preset, int p_device, BitField<EditorExportPlatform::DebugFlags> p_debug_flags) {462cleanup();463if (p_device) { // Stop command, cleanup only.464return OK;465}466467EditorProgress ep("run", TTR("Running..."), 5);468469const String dest = EditorPaths::get_singleton()->get_temp_dir().path_join("linuxbsd");470Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);471if (!da->dir_exists(dest)) {472Error err = da->make_dir_recursive(dest);473if (err != OK) {474EditorNode::get_singleton()->show_warning(TTR("Could not create temp directory:") + "\n" + dest);475return err;476}477}478479String host = p_preset->get("ssh_remote_deploy/host").operator String();480String port = p_preset->get("ssh_remote_deploy/port").operator String();481if (port.is_empty()) {482port = "22";483}484Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ", false);485Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ", false);486487const String basepath = dest.path_join("tmp_linuxbsd_export");488489#define CLEANUP_AND_RETURN(m_err) \490{ \491if (da->file_exists(basepath + ".zip")) { \492da->remove(basepath + ".zip"); \493} \494if (da->file_exists(basepath + "_start.sh")) { \495da->remove(basepath + "_start.sh"); \496} \497if (da->file_exists(basepath + "_clean.sh")) { \498da->remove(basepath + "_clean.sh"); \499} \500return m_err; \501} \502((void)0)503504if (ep.step(TTR("Exporting project..."), 1)) {505return ERR_SKIP;506}507Error err = export_project(p_preset, true, basepath + ".zip", p_debug_flags);508if (err != OK) {509DirAccess::remove_file_or_error(basepath + ".zip");510return err;511}512513String cmd_args;514{515Vector<String> cmd_args_list = gen_export_flags(p_debug_flags);516for (int i = 0; i < cmd_args_list.size(); i++) {517if (i != 0) {518cmd_args += " ";519}520cmd_args += cmd_args_list[i];521}522}523524const bool use_remote = p_debug_flags.has_flag(DEBUG_FLAG_REMOTE_DEBUG) || p_debug_flags.has_flag(DEBUG_FLAG_DUMB_CLIENT);525int dbg_port = EDITOR_GET("network/debug/remote_port");526527print_line("Creating temporary directory...");528ep.step(TTR("Creating temporary directory..."), 2);529String temp_dir;530err = ssh_run_on_remote(host, port, extra_args_ssh, "mktemp -d", &temp_dir);531if (err != OK || temp_dir.is_empty()) {532CLEANUP_AND_RETURN(err);533}534535print_line("Uploading archive...");536ep.step(TTR("Uploading archive..."), 3);537err = ssh_push_to_remote(host, port, extra_args_scp, basepath + ".zip", temp_dir);538if (err != OK) {539CLEANUP_AND_RETURN(err);540}541542{543String run_script = p_preset->get("ssh_remote_deploy/run_script");544run_script = run_script.replace("{temp_dir}", temp_dir);545run_script = run_script.replace("{archive_name}", basepath.get_file() + ".zip");546run_script = run_script.replace("{exe_name}", basepath.get_file());547run_script = run_script.replace("{cmd_args}", cmd_args);548549Ref<FileAccess> f = FileAccess::open(basepath + "_start.sh", FileAccess::WRITE);550if (f.is_null()) {551CLEANUP_AND_RETURN(err);552}553554f->store_string(run_script);555}556557{558String clean_script = p_preset->get("ssh_remote_deploy/cleanup_script");559clean_script = clean_script.replace("{temp_dir}", temp_dir);560clean_script = clean_script.replace("{archive_name}", basepath.get_file() + ".zip");561clean_script = clean_script.replace("{exe_name}", basepath.get_file());562clean_script = clean_script.replace("{cmd_args}", cmd_args);563564Ref<FileAccess> f = FileAccess::open(basepath + "_clean.sh", FileAccess::WRITE);565if (f.is_null()) {566CLEANUP_AND_RETURN(err);567}568569f->store_string(clean_script);570}571572print_line("Uploading scripts...");573ep.step(TTR("Uploading scripts..."), 4);574err = ssh_push_to_remote(host, port, extra_args_scp, basepath + "_start.sh", temp_dir);575if (err != OK) {576CLEANUP_AND_RETURN(err);577}578err = ssh_run_on_remote(host, port, extra_args_ssh, vformat("chmod +x \"%s/%s\"", temp_dir, basepath.get_file() + "_start.sh"));579if (err != OK || temp_dir.is_empty()) {580CLEANUP_AND_RETURN(err);581}582err = ssh_push_to_remote(host, port, extra_args_scp, basepath + "_clean.sh", temp_dir);583if (err != OK) {584CLEANUP_AND_RETURN(err);585}586err = ssh_run_on_remote(host, port, extra_args_ssh, vformat("chmod +x \"%s/%s\"", temp_dir, basepath.get_file() + "_clean.sh"));587if (err != OK || temp_dir.is_empty()) {588CLEANUP_AND_RETURN(err);589}590591print_line("Starting project...");592ep.step(TTR("Starting project..."), 5);593err = 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);594if (err != OK) {595CLEANUP_AND_RETURN(err);596}597598cleanup_commands.clear();599cleanup_commands.push_back(SSHCleanupCommand(host, port, extra_args_ssh, vformat("\"%s/%s\"", temp_dir, basepath.get_file() + "_clean.sh")));600601print_line("Project started.");602603CLEANUP_AND_RETURN(OK);604#undef CLEANUP_AND_RETURN605}606607void EditorExportPlatformLinuxBSD::initialize() {608if (EditorNode::get_singleton()) {609Ref<Image> img = memnew(Image);610const bool upsample = !Math::is_equal_approx(Math::round(EDSCALE), EDSCALE);611612ImageLoaderSVG::create_image_from_string(img, _linuxbsd_logo_svg, EDSCALE, upsample, false);613set_logo(ImageTexture::create_from_image(img));614615ImageLoaderSVG::create_image_from_string(img, _linuxbsd_run_icon_svg, EDSCALE, upsample, false);616run_icon = ImageTexture::create_from_image(img);617618Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme();619if (theme.is_valid()) {620stop_icon = theme->get_icon(SNAME("Stop"), EditorStringName(EditorIcons));621} else {622stop_icon.instantiate();623}624}625}626627628