diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-12-05 07:52:12 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-12-05 09:12:55 +0200 |
commit | 0e2f297806dc204f2b61dd3727d5ec360205cbdd (patch) | |
tree | 64ea7def41fba83df3a9c0a8f4e637f78a400cf8 /platform/ios | |
parent | 654132cb9c6ff1f27be0bf325e348e74b3e49fba (diff) | |
download | redot-engine-0e2f297806dc204f2b61dd3727d5ec360205cbdd.tar.gz |
[iOS] Use mdfind to check if Xcode is installed in one-click deploy code.
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/export/export_plugin.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp index c0e052865f..6bc3241425 100644 --- a/platform/ios/export/export_plugin.cpp +++ b/platform/ios/export/export_plugin.cpp @@ -2074,15 +2074,21 @@ bool EditorExportPlatformIOS::is_package_name_valid(const String &p_package, Str 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; + Vector<String> mdfind_paths; + List<String> mdfind_args; + mdfind_args.push_back("kMDItemCFBundleIdentifier=com.apple.dt.Xcode"); + + String output; + Error err = OS::get_singleton()->execute("mdfind", mdfind_args, &output); + if (err == OK) { + mdfind_paths = output.split("\n"); + } + for (const String &found_path : mdfind_paths) { + xcode_found = !found_path.is_empty() && DirAccess::dir_exists_absolute(found_path.strip_edges()); + if (xcode_found) { + break; + } } - xcode_found = DirAccess::dir_exists_absolute(xcode_path.strip_edges()); } return xcode_found; } |