mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Add isFileSynced helper func to FileProviderFilesUtils
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
5f9f0311d1
commit
9ff66bb94f
1 changed files with 14 additions and 0 deletions
|
@ -102,3 +102,17 @@ func parentItemIdentifierFromMetadata(_ metadata: NextcloudFileMetadataTable) ->
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func isFileSynced(metadata: NextcloudFileMetadataTable) -> Bool {
|
||||
do {
|
||||
let localPathForFile = try localPathForNCFile(fileMetadata: metadata)
|
||||
let localFileAttributes = try FileManager.default.attributesOfItem(atPath: localPathForFile.path)
|
||||
let localFileSize = localFileAttributes[.size] as? Int64
|
||||
|
||||
return localFileSize == metadata.size
|
||||
} catch let error {
|
||||
print("Could not check if file %@ is synced, received error: %@", metadata.fileNameView, error)
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue