locateIosBridge function
Finds the bridge: explicit arg, then bridgePathEnv, then a build inside glint's package (newest of release and debug), then the download cache; BridgeSource.missing points at the cache path.
Implementation
BridgeLocation locateIosBridge(String? explicit, {Map<String, String>? env, String? scriptPath}) {
if (explicit != null && explicit.isNotEmpty) {
return BridgeLocation(explicit, BridgeSource.argument);
}
final fromEnv = (env ?? Platform.environment)[bridgePathEnv];
if (fromEnv != null && fromEnv.isNotEmpty) {
return BridgeLocation(fromEnv, BridgeSource.env);
}
final built = _bridgeUnderGlintRoot(scriptPath);
if (built != null) return BridgeLocation(built, BridgeSource.build);
final cached = cachedBridgePath(env: env);
if (File(cached).existsSync()) return BridgeLocation(markHelperUsed(cached), BridgeSource.cache);
return BridgeLocation(cached, BridgeSource.missing);
}