mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
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:
@@ -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)")
|
||||
|
||||
Reference in New Issue
Block a user