From ae012f2381d510cbdd2088c5d55dec05ae0d3000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 9 Dec 2017 11:41:56 +0100 Subject: Windows export: Use WINE to run rcedit on non-Windows host WINE can be either run from a provided path ("export/windows/wine"), or looked up in the system PATH. Fixes #14441. --- platform/windows/export/export.cpp | 44 +++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'platform/windows') diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index 895c2c8f9b..1b6a8f4a60 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -48,6 +48,30 @@ Error EditorExportPlatformWindows::export_project(const Ref } String rcedit_path = EditorSettings::get_singleton()->get("export/windows/rcedit"); + + if (rcedit_path == String()) { + return OK; + } + + if (!FileAccess::exists(rcedit_path)) { + ERR_PRINTS("Could not find rcedit executable at " + rcedit_path + ", aborting."); + return ERR_FILE_NOT_FOUND; + } + +#ifndef WINDOWS_ENABLED + // On non-Windows we need WINE to run rcedit + String wine_path = EditorSettings::get_singleton()->get("export/windows/wine"); + + if (wine_path != String() && !FileAccess::exists(wine_path)) { + ERR_PRINTS("Could not find wine executable at " + wine_path + ", aborting."); + return ERR_FILE_NOT_FOUND; + } + + if (wine_path == String()) { + wine_path = "wine"; // try to run wine from PATH + } +#endif + String icon_path = p_preset->get("application/icon"); String file_verion = p_preset->get("application/file_version"); String product_version = p_preset->get("application/product_version"); @@ -58,14 +82,6 @@ Error EditorExportPlatformWindows::export_project(const Ref String trademarks = p_preset->get("application/trademarks"); String comments = p_preset->get("application/comments"); - if (rcedit_path == String()) { - return OK; - } - - if (!FileAccess::exists(rcedit_path)) { - return ERR_FILE_NOT_FOUND; - } - List args; args.push_back(p_path); if (icon_path != String()) { @@ -106,7 +122,14 @@ Error EditorExportPlatformWindows::export_project(const Ref args.push_back(trademarks); } +#ifdef WINDOWS_ENABLED OS::get_singleton()->execute(rcedit_path, args, true); +#else + // On non-Windows we need WINE to run rcedit + args.push_front(rcedit_path); + OS::get_singleton()->execute(wine_path, args, true); +#endif + return OK; } @@ -127,6 +150,11 @@ void register_windows_exporter() { EDITOR_DEF("export/windows/rcedit", ""); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/rcedit", PROPERTY_HINT_GLOBAL_FILE, "*.exe")); +#ifndef WINDOWS_ENABLED + // On non-Windows we need WINE to run rcedit + EDITOR_DEF("export/windows/wine", ""); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/wine", PROPERTY_HINT_GLOBAL_FILE)); +#endif Ref platform; platform.instance(); -- cgit v1.2.3