[iOS] Use mdfind to check if Xcode is installed in one-click deploy code.
(cherry picked from commit 0e2f297806
)
This commit is contained in:
parent
24a383e2ec
commit
65677df124
@ -2074,15 +2074,21 @@ bool EditorExportPlatformIOS::is_package_name_valid(const String &p_package, Str
|
|||||||
bool EditorExportPlatformIOS::_check_xcode_install() {
|
bool EditorExportPlatformIOS::_check_xcode_install() {
|
||||||
static bool xcode_found = false;
|
static bool xcode_found = false;
|
||||||
if (!xcode_found) {
|
if (!xcode_found) {
|
||||||
String xcode_path;
|
Vector<String> mdfind_paths;
|
||||||
List<String> args;
|
List<String> mdfind_args;
|
||||||
args.push_back("-p");
|
mdfind_args.push_back("kMDItemCFBundleIdentifier=com.apple.dt.Xcode");
|
||||||
int ec = 0;
|
|
||||||
Error err = OS::get_singleton()->execute("xcode-select", args, &xcode_path, &ec, true);
|
String output;
|
||||||
if (err != OK || ec != 0) {
|
Error err = OS::get_singleton()->execute("mdfind", mdfind_args, &output);
|
||||||
return false;
|
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;
|
return xcode_found;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user