fix: disk free size not updating (#325). The system returns the same value. Fixed by wrapping URL to the URL???

This commit is contained in:
Serhiy Mytrovtsiy
2021-01-31 15:22:13 +01:00
parent ab04e572b3
commit 74df6b50f7

View File

@@ -203,9 +203,11 @@ internal class CapacityReader: Reader<DiskList> {
private func freeDiskSpaceInBytes(_ path: URL) -> Int64 {
do {
let values = try path.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey])
if let capacity = values.volumeAvailableCapacityForImportantUsage {
return capacity
if let url = URL(string: path.absoluteString) {
let values = try url.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey])
if let capacity = values.volumeAvailableCapacityForImportantUsage {
return capacity
}
}
} catch {
os_log(.error, log: log, "error retrieving free space #1: %s", "\(error.localizedDescription)")