Fix file metadata save
This commit is contained in:
@@ -235,3 +235,10 @@ enum FileType: String {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension FileType: CustomStringConvertible {
|
||||
|
||||
var description: String {
|
||||
rawValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user