Actually write files log
This commit is contained in:
parent
10267e3765
commit
e5804ac0c7
@ -61,26 +61,6 @@ final class FileGenerator {
|
|||||||
print("")
|
print("")
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeResultsToFile(file: URL) throws {
|
|
||||||
var lines: [String] = []
|
|
||||||
func add<S>(_ name: String, _ property: S, convert: (S.Element) -> String) where S: Sequence {
|
|
||||||
let elements = property.map { " " + convert($0) }.sorted()
|
|
||||||
guard !elements.isEmpty else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
lines.append("\(name):")
|
|
||||||
lines.append(contentsOf: elements)
|
|
||||||
}
|
|
||||||
add("Missing files", missingFiles) { "\($0.key) (required by \($0.value))" }
|
|
||||||
add("Unreadable files", unreadableFiles) { "\($0.key) (required by \($0.value.source)): \($0.value.message)" }
|
|
||||||
add("Unreadable files", unreadableFiles) { "\($0.key) (required by \($0.value.source)): \($0.value.message)" }
|
|
||||||
add("Unwritable files", unwritableFiles) { "\($0.key) (required by \($0.value.source)): \($0.value.message)" }
|
|
||||||
add("External files", files.external) { "\($0.key) (from \($0.value))" }
|
|
||||||
|
|
||||||
let data = lines.joined(separator: "\n").data(using: .utf8)!
|
|
||||||
try data.createFolderAndWrite(to: file)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func didCopyFile() {
|
private func didCopyFile() {
|
||||||
numberOfCopiedFiles += 1
|
numberOfCopiedFiles += 1
|
||||||
print(" Copied files: \(numberOfCopiedFiles)/\(numberOfFilesToCopy) \r", terminator: "")
|
print(" Copied files: \(numberOfCopiedFiles)/\(numberOfFilesToCopy) \r", terminator: "")
|
||||||
|
@ -113,6 +113,8 @@ private func copyFiles(files: FileData, configuration: Configuration, runFolder:
|
|||||||
runFolder: runFolder,
|
runFolder: runFolder,
|
||||||
files: files)
|
files: files)
|
||||||
generator.generate()
|
generator.generate()
|
||||||
|
let file = runFolder.appendingPathComponent("files.txt")
|
||||||
|
generator.writeResults(to: file)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func finish(start: Date, complete: Bool) {
|
private func finish(start: Date, complete: Bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user