Skip to content

Commit

Permalink
Merge pull request #85168 from bruvzg/ios_xc_check
Browse files Browse the repository at this point in the history
[iOS] Check if Xcode is installed in one-click deploy code.
  • Loading branch information
akien-mga committed Nov 21, 2023
2 parents 0e33036 + eceaaea commit 132554b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion platform/ios/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions platform/ios/export/export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 132554b

Please sign in to comment.