Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit ec53269

Browse files
committed
Create iCloud Documents directory if missing
1 parent 5bf36b6 commit ec53269

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/SwiftPlaygroundsKit/PlaygroundBook+Generate.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ public extension PlaygroundBook {
1818
// Otherwise return out of function
1919
return
2020
}
21+
// Check if iCloud Path does not exists
22+
if !self.fileManager.fileExists(atPath: self.iCloudPath.rawValue) {
23+
// Create iCloud Path directory and discard error
24+
_ = try? self.fileManager.createDirectory(
25+
atPath: self.iCloudPath.rawValue,
26+
withIntermediateDirectories: false,
27+
attributes: nil
28+
)
29+
}
2130
// Try to copy Template File to Destination File Path
2231
try self.fileManager.copyItem(
2332
atPath: self.templateFilePath.rawValue,

0 commit comments

Comments
 (0)