Fix file metadata save

This commit is contained in:
Christoph Hagen
2026-01-08 22:40:25 +01:00
parent 07ba77e337
commit 57fa5aa3dd
3 changed files with 13 additions and 0 deletions

View File

@@ -235,3 +235,10 @@ enum FileType: String {
}
}
}
extension FileType: CustomStringConvertible {
var description: String {
rawValue
}
}

View File

@@ -108,6 +108,9 @@ struct AddFileView: View {
content.add(resource)
selectedFile = resource
}
// We need to ensure that the metadata file is written to disk directly
content.saveUnconditionally()
content.generateMissingVideoThumbnails()
dismiss()
}

View File

@@ -181,6 +181,7 @@ struct FileDetailView: View {
markFileAsChanged()
if file.isExternallyStored {
DispatchQueue.main.async {
// This will also trigger a save
file.isExternallyStored = false
}
}
@@ -215,6 +216,7 @@ struct FileDetailView: View {
return
}
DispatchQueue.main.async {
// This will also trigger a save
file.fileSize = nil
file.isExternallyStored = true
}
@@ -225,6 +227,7 @@ struct FileDetailView: View {
print("File '\(file.identifier)': Failed to delete file in content folder")
return
}
// This will also trigger a save
content.remove(file)
selection.remove(file)
}