From ceef056146b62d9580ab600fbf453e386023bf1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 23 Aug 2022 12:47:53 +0200 Subject: [PATCH] Mono: Show custom error explaining that UWP is not supported Fixes #64490. --- platform/uwp/export/export.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 1cdd816de59..2e795f527de 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "export.h" + #include "core/bind/core_bind.h" #include "core/crypto/crypto_core.h" #include "core/io/marshalls.h" @@ -42,6 +43,12 @@ #include "editor/editor_node.h" #include "platform/uwp/logo.gen.h" +// Mono build doesn't support UWP, so we show a specific error. +// We don't bypass the whole logic so that it doesn't lose potential UWP presets +// added to export_presets.cfg from a non-Mono build (and in case third-parties +// actually have Mono-enabled UWP templates they can use). +#include "modules/modules_enabled.gen.h" // For mono. + #include "thirdparty/minizip/unzip.h" #include "thirdparty/minizip/zip.h" @@ -1110,11 +1117,20 @@ public: } valid = dvalid || rvalid; + +#ifdef MODULE_MONO_ENABLED + // If this is a Mono build, provide a custom error so that users are not confused. + // We don't bypass the whole logic to check templates because third-parties might have + // Mono-enabled UWP builds using this path. + r_missing_templates = false; // Don't warn about those. + r_error = TTR("Godot's Mono version does not support the UWP platform. Use the standard build (no C# support) if you wish to target UWP."); +#else r_missing_templates = !valid; if (!err.empty()) { r_error = err; } +#endif // MODULE_MONO_ENABLED return valid; } @@ -1123,6 +1139,17 @@ public: String err; bool valid = true; +#ifdef MODULE_MONO_ENABLED + // Don't warn about project configuration issue if this is a Mono build + // without custom-provided Mono-enabled UWP templates. + // We check if we have valid templates to decide if we should actually + // validate the config. + bool tmp; + if (!has_valid_export_configuration(p_preset, err, tmp)) { + return false; + } +#endif // MODULE_MONO_ENABLED + // Validate the rest of the configuration. if (!_valid_resource_name(p_preset->get("package/short_name"))) {