Show errors during loading

This commit is contained in:
Christoph Hagen
2025-01-09 09:31:05 +01:00
parent a7197b9628
commit 93c8d06f23
12 changed files with 97 additions and 39 deletions

View File

@@ -40,9 +40,6 @@ final class Content: ObservableObject {
@Published
private(set) var shouldGenerateWebsite = false
@State
var selectedFile: FileResource?
let imageGenerator: ImageGenerator
init(settings: Settings,
@@ -136,16 +133,18 @@ final class Content: ObservableObject {
tag.remove(file)
}
settings.remove(file)
if selectedFile == file {
selectedFile = nil
}
}
func file(withOutputPath: String) -> FileResource? {
files.first { $0.absoluteUrl == withOutputPath }
}
private let errorPrinter = ErrorPrinter()
func loadFromDisk(callback: @escaping (_ errors: [String]) -> ()) {
defer {
storage.contentScope?.delegate = errorPrinter
}
DispatchQueue.global().async {
let loader = ModelLoader(content: self, storage: self.storage)
let result = loader.load()