diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-12-09 11:41:56 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-12-09 11:42:08 +0100 |
commit | ae012f2381d510cbdd2088c5d55dec05ae0d3000 (patch) | |
tree | 2a596d6c25a58f99426a509c2e313e9af7f5f16a /platform/windows | |
parent | 3fd1c0c76b61173c5d611b14b5b137fb61654f08 (diff) |
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.
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/export/export.cpp | 44 |
1 files changed, 36 insertions, 8 deletions
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<EditorExportPreset> } 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<EditorExportPreset> 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<String> args; args.push_back(p_path); if (icon_path != String()) { @@ -106,7 +122,14 @@ Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset> 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<EditorExportPlatformWindows> platform; platform.instance(); |