Skip to content

Commit 8f8114b

Browse files
committed
Only create the directory if it does not exist
1 parent b198a56 commit 8f8114b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/SnapshotTesting/AssertSnapshot.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ public func verifySnapshot<Value, Format>(
331331
snapshotFileUrl = snapshotFileUrl.appendingPathExtension(ext)
332332
}
333333
let fileManager = FileManager.default
334-
try fileManager.createDirectory(at: snapshotDirectoryUrl, withIntermediateDirectories: true)
334+
if !fileManager.fileExists(atPath: snapshotDirectoryUrl.path) {
335+
try fileManager.createDirectory(at: snapshotDirectoryUrl, withIntermediateDirectories: true)
336+
}
335337

336338
let tookSnapshot = XCTestExpectation(description: "Took snapshot")
337339
var optionalDiffable: Format?

0 commit comments

Comments
 (0)