diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-08 21:56:05 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-08 21:56:05 +0200 |
commit | d2c7f093534d3b80b6db3fd4b2603f8532c88cf6 (patch) | |
tree | 845a7371bde55ad3ad7f25b7f08993ba7e518537 | |
parent | 0c6b5efab329b0e43348b2fd3a291dfae70e96aa (diff) | |
parent | 07c73063e3dbaf03f25cbf5c2c27d1d6281bd214 (diff) | |
download | redot-engine-d2c7f093534d3b80b6db3fd4b2603f8532c88cf6.tar.gz |
Merge pull request #90387 from AThousandShips/console_wrap_fix
[Windows] Support all possible suffixes for console wrapper
-rw-r--r-- | editor/export/editor_export_platform_pc.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/editor/export/editor_export_platform_pc.cpp b/editor/export/editor_export_platform_pc.cpp index 7cd8cb9b29..f583c0ec02 100644 --- a/editor/export/editor_export_platform_pc.cpp +++ b/editor/export/editor_export_platform_pc.cpp @@ -151,15 +151,28 @@ Error EditorExportPlatformPC::prepare_template(const Ref<EditorExportPreset> &p_ return ERR_FILE_NOT_FOUND; } - String wrapper_template_path = template_path.get_basename() + "_console.exe"; + // Matching the extensions in platform/windows/console_wrapper_windows.cpp + static const char *const wrapper_extensions[] = { + ".console.exe", + "_console.exe", + " console.exe", + "console.exe", + nullptr, + }; int con_wrapper_mode = p_preset->get("debug/export_console_wrapper"); bool copy_wrapper = (con_wrapper_mode == 1 && p_debug) || (con_wrapper_mode == 2); Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); da->make_dir_recursive(p_path.get_base_dir()); Error err = da->copy(template_path, p_path, get_chmod_flags()); - if (err == OK && copy_wrapper && FileAccess::exists(wrapper_template_path)) { - err = da->copy(wrapper_template_path, p_path.get_basename() + ".console.exe", get_chmod_flags()); + if (err == OK && copy_wrapper) { + for (int i = 0; wrapper_extensions[i]; ++i) { + const String wrapper_path = template_path.get_basename() + wrapper_extensions[i]; + if (FileAccess::exists(wrapper_path)) { + err = da->copy(wrapper_path, p_path.get_basename() + ".console.exe", get_chmod_flags()); + break; + } + } } if (err != OK) { add_message(EXPORT_MESSAGE_ERROR, TTR("Prepare Template"), TTR("Failed to copy export template.")); |