| 951 | } |
| 952 | |
| 953 | Error EditorExportPlatformWindows::run(const Ref<EditorExportPreset> &p_preset, int p_device, BitField<EditorExportPlatform::DebugFlags> p_debug_flags) { |
| 954 | cleanup(); |
| 955 | if (p_device) { // Stop command, cleanup only. |
| 956 | return OK; |
| 957 | } |
| 958 | |
| 959 | EditorProgress ep("run", TTR("Running..."), 5); |
| 960 | |
| 961 | const String dest = EditorPaths::get_singleton()->get_temp_dir().path_join("windows"); |
| 962 | Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); |
| 963 | if (!da->dir_exists(dest)) { |
| 964 | Error err = da->make_dir_recursive(dest); |
| 965 | if (err != OK) { |
| 966 | EditorNode::get_singleton()->show_warning(TTR("Could not create temp directory:") + "\n" + dest); |
| 967 | return err; |
| 968 | } |
| 969 | } |
| 970 | |
| 971 | String host = p_preset->get("ssh_remote_deploy/host").operator String(); |
| 972 | String port = p_preset->get("ssh_remote_deploy/port").operator String(); |
| 973 | if (port.is_empty()) { |
| 974 | port = "22"; |
| 975 | } |
| 976 | Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ", false); |
| 977 | Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ", false); |
| 978 | |
| 979 | const String basepath = dest.path_join("tmp_windows_export"); |
| 980 | |
| 981 | #define CLEANUP_AND_RETURN(m_err) \ |
| 982 | { \ |
| 983 | if (da->file_exists(basepath + ".zip")) { \ |
| 984 | da->remove(basepath + ".zip"); \ |
| 985 | } \ |
| 986 | if (da->file_exists(basepath + "_start.ps1")) { \ |
| 987 | da->remove(basepath + "_start.ps1"); \ |
| 988 | } \ |
| 989 | if (da->file_exists(basepath + "_clean.ps1")) { \ |
| 990 | da->remove(basepath + "_clean.ps1"); \ |
| 991 | } \ |
| 992 | return m_err; \ |
| 993 | } \ |
| 994 | ((void)0) |
| 995 | |
| 996 | if (ep.step(TTR("Exporting project..."), 1)) { |
| 997 | return ERR_SKIP; |
| 998 | } |
| 999 | Error err = export_project(p_preset, true, basepath + ".zip", p_debug_flags); |
| 1000 | if (err != OK) { |
| 1001 | DirAccess::remove_file_or_error(basepath + ".zip"); |
| 1002 | return err; |
| 1003 | } |
| 1004 | |
| 1005 | String cmd_args; |
| 1006 | { |
| 1007 | Vector<String> cmd_args_list = gen_export_flags(p_debug_flags); |
| 1008 | for (int i = 0; i < cmd_args_list.size(); i++) { |
| 1009 | if (i != 0) { |
| 1010 | cmd_args += " "; |
nothing calls this directly
no test coverage detected