summaryrefslogtreecommitdiffstats
path: root/platform
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-11-21 15:06:32 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-11-21 15:06:32 +0100
commit132554badd6860cb530505ec0dfe07c3f05f5889 (patch)
tree5769cf0b984033ff007c90cfc3e67b2e1872654f /platform
parent0e33036d199fcb931bea27069fb7d6589c7f3824 (diff)
parenteceaaea2fe8bb2866c1395d69af7894938560979 (diff)
downloadredot-engine-132554badd6860cb530505ec0dfe07c3f05f5889.tar.gz
Merge pull request #85168 from bruvzg/ios_xc_check
[iOS] Check if Xcode is installed in one-click deploy code.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/export/export_plugin.cpp18
-rw-r--r--platform/ios/export/export_plugin.h1
2 files changed, 18 insertions, 1 deletions
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp
index 94984a74b6..c0e052865f 100644
--- a/platform/ios/export/export_plugin.cpp
+++ b/platform/ios/export/export_plugin.cpp
@@ -2071,6 +2071,22 @@ bool EditorExportPlatformIOS::is_package_name_valid(const String &p_package, Str
}
#ifdef MACOS_ENABLED
+bool EditorExportPlatformIOS::_check_xcode_install() {
+ static bool xcode_found = false;
+ if (!xcode_found) {
+ String xcode_path;
+ List<String> args;
+ args.push_back("-p");
+ int ec = 0;
+ Error err = OS::get_singleton()->execute("xcode-select", args, &xcode_path, &ec, true);
+ if (err != OK || ec != 0) {
+ return false;
+ }
+ xcode_found = DirAccess::dir_exists_absolute(xcode_path.strip_edges());
+ }
+ return xcode_found;
+}
+
void EditorExportPlatformIOS::_check_for_changes_poll_thread(void *ud) {
EditorExportPlatformIOS *ea = static_cast<EditorExportPlatformIOS *>(ud);
@@ -2138,7 +2154,7 @@ void EditorExportPlatformIOS::_check_for_changes_poll_thread(void *ud) {
}
// Enum simulators
- if (FileAccess::exists("/usr/bin/xcrun") || FileAccess::exists("/bin/xcrun")) {
+ if (_check_xcode_install() && (FileAccess::exists("/usr/bin/xcrun") || FileAccess::exists("/bin/xcrun"))) {
String devices;
List<String> args;
args.push_back("simctl");
diff --git a/platform/ios/export/export_plugin.h b/platform/ios/export/export_plugin.h
index 27a4d73fcd..951017ddae 100644
--- a/platform/ios/export/export_plugin.h
+++ b/platform/ios/export/export_plugin.h
@@ -81,6 +81,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
Thread check_for_changes_thread;
SafeFlag quit_request;
+ static bool _check_xcode_install();
static void _check_for_changes_poll_thread(void *ud);
#endif