···2323 return try component.read(from: directoryURL)
2424 }
25252626- public func write(_ data: Component.Content, to url: URL) throws {
2727- let directoryPath = url.appending(component: path.description)
2828-2929- if !FileManager.default.fileExists(atPath: directoryPath.path()) {
3030- try FileManager.default.createDirectory(at: directoryPath, withIntermediateDirectories: false)
3131- }
3232-3333- try component.write(data, to: directoryPath)
3434- }
2626+ // public func write(_ data: Component.Content, to url: URL) throws {
2727+ // let directoryPath = url.appending(component: path.description)
2828+ //
2929+ // if !FileManager.default.fileExists(atPath: directoryPath.path()) {
3030+ // try FileManager.default.createDirectory(at: directoryPath, withIntermediateDirectories: false)
3131+ // }
3232+ //
3333+ // try component.write(data, to: directoryPath)
3434+ // }
3535}
36363737···6363 }.sorted(by: { $0.directoryName < $1.directoryName })
6464 }
65656666- public func write(_ data: [DirectoryContent<Component.Content>], to url: URL) throws {
6767- guard writingToEmptyDirectory
6868- else {
6969- reportIssue("""
7070- Writing a `Many` to a directory that may already have contents currently unsupported.
7171-7272- This is because it is difficult to determine if a value that does not exist in the array of values getting written should be deleted because it was removed,
7373- or if it exists outside of the purview of the `Many { }` block and should be left alone.
7474-7575- The semantics of Many may need to be tweaked to make this determination more clear.
7676-7777- To allow writing to the directory, use:
7878-7979- ```
8080- $writingToEmptyDirectory.withValue(true) {
8181- Directories { StaticFile($0, "txt") }.write(...)
8282- }
8383- ```
8484-8585- which will naively write all the contents to the directory, and not delete anything that is already there.
8686- """)
8787- return
8888- }
8989-9090-9191-9292- if !FileManager.default.fileExists(atPath: url.path()) {
9393- try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)
9494- }
9595-9696- for directoryContent in data {
9797- let directoryURL = url.appendingPathComponent(directoryContent.directoryName)
9898-9999- if !FileManager.default.fileExists(atPath: directoryURL.path()) {
100100- try FileManager.default.createDirectory(at: directoryURL, withIntermediateDirectories: false)
101101- }
102102-103103- try component.write(directoryContent.components, to: directoryURL)
104104- }
105105- }
6666+ // public func write(_ data: [DirectoryContent<Component.Content>], to url: URL) throws {
6767+ // guard writingToEmptyDirectory
6868+ // else {
6969+ // reportIssue("""
7070+ // Writing a `Many` to a directory that may already have contents currently unsupported.
7171+ //
7272+ // This is because it is difficult to determine if a value that does not exist in the array of values getting written should be deleted because it was removed,
7373+ // or if it exists outside of the purview of the `Many { }` block and should be left alone.
7474+ //
7575+ // The semantics of Many may need to be tweaked to make this determination more clear.
7676+ //
7777+ // To allow writing to the directory, use:
7878+ //
7979+ // ```
8080+ // $writingToEmptyDirectory.withValue(true) {
8181+ // Directories { StaticFile($0, "txt") }.write(...)
8282+ // }
8383+ // ```
8484+ //
8585+ // which will naively write all the contents to the directory, and not delete anything that is already there.
8686+ // """)
8787+ // return
8888+ // }
8989+ //
9090+ //
9191+ //
9292+ // if !FileManager.default.fileExists(atPath: url.path()) {
9393+ // try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)
9494+ // }
9595+ //
9696+ // for directoryContent in data {
9797+ // let directoryURL = url.appendingPathComponent(directoryContent.directoryName)
9898+ //
9999+ // if !FileManager.default.fileExists(atPath: directoryURL.path()) {
100100+ // try FileManager.default.createDirectory(at: directoryURL, withIntermediateDirectories: false)
101101+ // }
102102+ //
103103+ // try component.write(directoryContent.components, to: directoryURL)
104104+ // }
105105+ // }
106106 }
107107108108}