Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion MiniSim/Service/DeviceDiscoveryService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ class IOSDeviceDiscovery: DeviceDiscoveryService {
}

func checkSetup() throws -> Bool {
FileManager.default.fileExists(atPath: DeviceConstants.ProcessPaths.xcrun.rawValue)
guard FileManager.default.fileExists(atPath: DeviceConstants.ProcessPaths.xcrun.rawValue) else {
return false
}

_ = try shell.execute(
command: DeviceConstants.ProcessPaths.xcrun.rawValue,
arguments: ["simctl", "list", "devices", "available", "-j"]
)
return true
}
}
12 changes: 10 additions & 2 deletions MiniSim/Service/DeviceServiceFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@ class DeviceServiceFactory {
var devicesArray: [Device] = []

if android {
try devicesArray.append(contentsOf: AndroidDeviceDiscovery().getDevices())
do {
try devicesArray.append(contentsOf: AndroidDeviceDiscovery().getDevices())
} catch {
// A broken Android installation must not prevent the iOS menu from opening.
}
}

if iOS {
try devicesArray.append(contentsOf: IOSDeviceDiscovery().getDevices())
do {
try devicesArray.append(contentsOf: IOSDeviceDiscovery().getDevices())
} catch {
// xcrun/simctl may be unavailable while the rest of MiniSim is usable.
}
}

completionQueue.async {
Expand Down