We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ddc2b2 commit 9eccae9Copy full SHA for 9eccae9
utils/gen-unicode-data/Sources/GenUtils/Files.swift
@@ -22,7 +22,16 @@ public func readFile(_ path: String) -> String {
22
23
public func write(_ data: String, to path: String) {
24
do {
25
- try data.write(toFile: path, atomically: false, encoding: .utf8)
+ let directory = path.prefix(upTo: path.lastIndex(of: "/") ?? path.endIndex)
26
+ try FileManager.default.createDirectory(
27
+ atPath: String(directory),
28
+ withIntermediateDirectories: true
29
+ )
30
+ try data.write(
31
+ toFile: path,
32
+ atomically: false,
33
+ encoding: .utf8
34
35
} catch {
36
fatalError(error.localizedDescription)
37
}
0 commit comments