Skip to content

Commit a9876a2

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

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PackageDescription
55
let package = Package(
66
name: "swift-snapshot-testing",
77
platforms: [
8-
.iOS(.v13),
8+
.iOS(.v16),
99
.macOS(.v10_15),
1010
.tvOS(.v13),
1111
.watchOS(.v6),

[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PackageDescription
55
let package = Package(
66
name: "swift-snapshot-testing",
77
platforms: [
8-
.iOS(.v13),
8+
.iOS(.v16),
99
.macOS(.v10_15),
1010
.tvOS(.v13),
1111
.watchOS(.v6),

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)