Check for unused files in output folder
This commit is contained in:
@ -45,6 +45,8 @@ final class Storage: ObservableObject {
|
||||
|
||||
var errorNotification: StorageErrorCallback?
|
||||
|
||||
var writeNotification: ((String) -> Void)?
|
||||
|
||||
/**
|
||||
Create the storage.
|
||||
*/
|
||||
@ -319,6 +321,7 @@ final class Storage: ObservableObject {
|
||||
*/
|
||||
func copy(file fileId: String, to relativeOutputPath: String) -> Bool {
|
||||
guard let contentScope, let outputScope else { return false }
|
||||
didWrite(outputFile: relativeOutputPath)
|
||||
return contentScope.transfer(
|
||||
file: filePath(file: fileId),
|
||||
to: relativeOutputPath, of: outputScope)
|
||||
@ -460,6 +463,7 @@ final class Storage: ObservableObject {
|
||||
@discardableResult
|
||||
func write(_ content: String, to relativeOutputPath: String) -> Bool {
|
||||
guard let outputScope else { return false }
|
||||
didWrite(outputFile: relativeOutputPath)
|
||||
return outputScope.write(content, to: relativeOutputPath)
|
||||
}
|
||||
|
||||
@ -468,6 +472,7 @@ final class Storage: ObservableObject {
|
||||
*/
|
||||
func write(_ data: Data, to relativeOutputPath: String) -> Bool {
|
||||
guard let outputScope else { return false }
|
||||
didWrite(outputFile: relativeOutputPath)
|
||||
return outputScope.write(data, to: relativeOutputPath)
|
||||
}
|
||||
|
||||
@ -584,4 +589,15 @@ final class Storage: ObservableObject {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: Output notifications
|
||||
|
||||
func didWrite(outputFile: String) {
|
||||
writeNotification?(outputFile)
|
||||
}
|
||||
|
||||
func getAllOutputFiles() -> Set<String> {
|
||||
guard let outputScope else { return [] }
|
||||
return outputScope.getAllFiles()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user