Skip to content

Commit

Permalink
Fixed macOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
samdeane committed Aug 20, 2024
1 parent 3969467 commit 40da6a0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Sources/XCTestExtensions/XCUIApplication+UITesting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@ public extension XCUIApplication {
var screenshotsURL: URL {
let env = ProcessInfo.processInfo.environment
let path = env["ScreenshotDirectory"] ?? "\(NSTemporaryDirectory())/Screenshots"
let url = URL(fileURLWithPath: path).appendingPathComponent(UIDevice.current.name)
var url = URL(fileURLWithPath: path)

let deviceName: String?
#if os(iOS)
deviceName = UIDevice.current.name
#else
deviceName = Host.current().name
#endif
if let deviceName {
url = url.appendingPathComponent(deviceName)
}

try? FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)
return url
Expand Down

0 comments on commit 40da6a0

Please sign in to comment.