Unverified Commit 9bd2e400 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

Throw exception if instantiating IOSDevice on non-mac os platform (#36288)

parent a52f0f77
...@@ -125,14 +125,12 @@ class IOSDevice extends Device { ...@@ -125,14 +125,12 @@ class IOSDevice extends Device {
ephemeral: true, ephemeral: true,
) { ) {
if (!platform.isMacOS) { if (!platform.isMacOS) {
printError('Cannot control iOS devices or simulators. ideviceinstaller and iproxy are not available on your platform.'); assert(false, 'Control of iOS devices or simulators only supported on Mac OS.');
_installerPath = null;
_iproxyPath = null;
return; return;
} }
_installerPath = artifacts.getArtifactPath( _installerPath = artifacts.getArtifactPath(
Artifact.ideviceinstaller, Artifact.ideviceinstaller,
platform: TargetPlatform.ios platform: TargetPlatform.ios,
) ?? 'ideviceinstaller'; // TODO(fujino): remove fallback once g3 updated ) ?? 'ideviceinstaller'; // TODO(fujino): remove fallback once g3 updated
_iproxyPath = artifacts.getArtifactPath( _iproxyPath = artifacts.getArtifactPath(
Artifact.iproxy, Artifact.iproxy,
...@@ -168,6 +166,9 @@ class IOSDevice extends Device { ...@@ -168,6 +166,9 @@ class IOSDevice extends Device {
bool get supportsStartPaused => false; bool get supportsStartPaused => false;
static Future<List<IOSDevice>> getAttachedDevices() async { static Future<List<IOSDevice>> getAttachedDevices() async {
if (!platform.isMacOS) {
throw UnsupportedError('Control of iOS devices or simulators only supported on Mac OS.');
}
if (!iMobileDevice.isInstalled) if (!iMobileDevice.isInstalled)
return <IOSDevice>[]; return <IOSDevice>[];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment