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

Method _export_project

platform/web/export/export_plugin.cpp:853–882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

851}
852
853Error EditorExportPlatformWeb::_export_project(const Ref<EditorExportPreset> &p_preset, int p_debug_flags) {
854 const String dest = EditorPaths::get_singleton()->get_temp_dir().path_join("web");
855 Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
856 if (!da->dir_exists(dest)) {
857 Error err = da->make_dir_recursive(dest);
858 if (err != OK) {
859 add_message(EXPORT_MESSAGE_ERROR, TTR("Run"), vformat(TTR("Could not create HTTP server directory: %s."), dest));
860 return err;
861 }
862 }
863
864 const String basepath = dest.path_join("tmp_js_export");
865 Error err = export_project(p_preset, true, basepath + ".html", p_debug_flags);
866 if (err != OK) {
867 // Export generates several files, clean them up on failure.
868 DirAccess::remove_file_or_error(basepath + ".html");
869 DirAccess::remove_file_or_error(basepath + ".offline.html");
870 DirAccess::remove_file_or_error(basepath + ".js");
871 DirAccess::remove_file_or_error(basepath + ".audio.worklet.js");
872 DirAccess::remove_file_or_error(basepath + ".audio.position.worklet.js");
873 DirAccess::remove_file_or_error(basepath + ".service.worker.js");
874 DirAccess::remove_file_or_error(basepath + ".pck");
875 DirAccess::remove_file_or_error(basepath + ".png");
876 DirAccess::remove_file_or_error(basepath + ".side.wasm");
877 DirAccess::remove_file_or_error(basepath + ".wasm");
878 DirAccess::remove_file_or_error(basepath + ".icon.png");
879 DirAccess::remove_file_or_error(basepath + ".apple-touch-icon.png");
880 }
881 return err;
882}
883
884Error EditorExportPlatformWeb::_launch_browser(const String &p_bind_host, const uint16_t p_bind_port, const bool p_use_tls) {
885 OS::get_singleton()->shell_open(String((p_use_tls ? "https://" : "http://") + p_bind_host + ":" + itos(p_bind_port) + "/tmp_js_export.html"));

Callers

nothing calls this directly

Calls 7

TTRFunction · 0.85
vformatFunction · 0.85
path_joinMethod · 0.80
createFunction · 0.50
get_temp_dirMethod · 0.45
dir_existsMethod · 0.45
make_dir_recursiveMethod · 0.45

Tested by

no test coverage detected