From c0ab0a0d0eec3fcfb9cd440407474e830f0fb727 Mon Sep 17 00:00:00 2001 From: Tomas Camin Date: Thu, 29 Dec 2022 12:49:51 +0100 Subject: [PATCH] Support simulator window name changes --- SBTUITunnelHostServer/Sources/SimulatorDescriptor.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SBTUITunnelHostServer/Sources/SimulatorDescriptor.swift b/SBTUITunnelHostServer/Sources/SimulatorDescriptor.swift index 5d21562..28b41ab 100644 --- a/SBTUITunnelHostServer/Sources/SimulatorDescriptor.swift +++ b/SBTUITunnelHostServer/Sources/SimulatorDescriptor.swift @@ -15,9 +15,11 @@ enum SimulatorDescriptor { case .byDeviceNameAndRuntime(let deviceName, var runtime): runtime = runtime.components(separatedBy: ".").prefix(2).joined(separator: ".") // 11.1.1 -> 11.1 let escapedDeviceName = NSRegularExpression.escapedPattern(for: deviceName) - let regex = "\(escapedDeviceName) (-|—) (iOS )?\(runtime)(\\.\\d)?" + let regex = "\(escapedDeviceName)( (-|—) (iOS )?\(runtime)(\\.\\d)?)?" + + let found = windowName.range(of: regex, options: .regularExpression, range: nil, locale: nil) != nil - return windowName.range(of: regex, options: .regularExpression, range: nil, locale: nil) != nil + return found } } }