зеркало из https://github.com/nextcloud/desktop.git
Remove unnecessary local file operations in FileProviderExt
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Родитель
221848f230
Коммит
8661841c44
|
@ -294,7 +294,7 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
|
|||
|
||||
// MARK: - Helper methods
|
||||
|
||||
private static func completeEnumerationObserver(_ observer: NSFileProviderEnumerationObserver, ncKit: NextcloudKit, numPage: Int, itemMetadatas: [NextcloudItemMetadataTable], createLocalFileOrDirectory: Bool = true) {
|
||||
private static func completeEnumerationObserver(_ observer: NSFileProviderEnumerationObserver, ncKit: NextcloudKit, numPage: Int, itemMetadatas: [NextcloudItemMetadataTable]) {
|
||||
|
||||
var items: [NSFileProviderItem] = []
|
||||
|
||||
|
@ -304,10 +304,6 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
|
|||
continue
|
||||
}
|
||||
|
||||
if createLocalFileOrDirectory {
|
||||
createFileOrDirectoryLocally(metadata: itemMetadata)
|
||||
}
|
||||
|
||||
if let parentItemIdentifier = NextcloudFilesDatabaseManager.shared.parentItemIdentifierFromMetadata(itemMetadata) {
|
||||
let item = FileProviderItem(metadata: itemMetadata, parentItemIdentifier: parentItemIdentifier, ncKit: ncKit)
|
||||
Logger.enumeration.debug("Will enumerate item with ocId: \(itemMetadata.ocId) and name: \(itemMetadata.fileName, privacy: OSLogPrivacy.auto(mask: .hash))")
|
||||
|
|
|
@ -50,16 +50,6 @@ func pathForFileProviderExtFiles() -> URL? {
|
|||
return folderPathUrl
|
||||
}
|
||||
|
||||
@discardableResult func localPathForNCDirectory(directoryMetadata: NextcloudDirectoryMetadataTable) throws -> URL {
|
||||
let ocId = directoryMetadata.ocId
|
||||
return try localPathForNCDirectory(ocId: ocId)
|
||||
}
|
||||
|
||||
@discardableResult func localPathForNCDirectory(itemMetadata: NextcloudItemMetadataTable) throws -> URL {
|
||||
let ocId = itemMetadata.ocId
|
||||
return try localPathForNCDirectory(ocId: ocId)
|
||||
}
|
||||
|
||||
@discardableResult func localPathForNCFile(ocId: String, fileNameView: String) throws -> URL {
|
||||
let fileFolderPathUrl = try localPathForNCDirectory(ocId: ocId)
|
||||
let filePathUrl = fileFolderPathUrl.appendingPathComponent(fileNameView)
|
||||
|
@ -71,21 +61,3 @@ func pathForFileProviderExtFiles() -> URL? {
|
|||
|
||||
return filePathUrl
|
||||
}
|
||||
|
||||
@discardableResult func localPathForNCFile(itemMetadata: NextcloudItemMetadataTable) throws -> URL {
|
||||
let ocId = itemMetadata.ocId
|
||||
let fileNameView = itemMetadata.fileNameView
|
||||
return try localPathForNCFile(ocId: ocId, fileNameView: fileNameView)
|
||||
}
|
||||
|
||||
func createFileOrDirectoryLocally(metadata: NextcloudItemMetadataTable) {
|
||||
do {
|
||||
if metadata.directory {
|
||||
try localPathForNCDirectory(ocId: metadata.ocId)
|
||||
} else {
|
||||
try localPathForNCFile(itemMetadata: metadata)
|
||||
}
|
||||
} catch let error {
|
||||
Logger.enumeration.error("Could not create NC file or directory locally, received error: \(error, privacy: .public)")
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче