Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Free space falls back to the plain figure where a volume gives no other
Țugui Dragoș4aa515217aa7
diff --git a/Packages/PeelCore/Sources/PeelCore/Home/DeviceInfo.swift b/Packages/PeelCore/Sources/PeelCore/Home/DeviceInfo.swiftindex 2c9fb559..c55d2b22 100644--- a/Packages/PeelCore/Sources/PeelCore/Home/DeviceInfo.swift+++ b/Packages/PeelCore/Sources/PeelCore/Home/DeviceInfo.swift@@ -94,8 +94,19 @@ public struct DeviceInfo: Sendable, Hashable {}public static func storage(of url: URL) -> Storage {- let values = try? url.resourceValues(forKeys: [.volumeTotalCapacityKey, .volumeAvailableCapacityForImportantUsageKey])- return Storage(total: Int64(values?.volumeTotalCapacity ?? 0), free: values?.volumeAvailableCapacityForImportantUsage ?? 0)+ let values = try? url.resourceValues(forKeys: [.volumeTotalCapacityKey, .volumeAvailableCapacityKey, .volumeAvailableCapacityForImportantUsageKey])+ return storage(+ total: values?.volumeTotalCapacity,+ available: values?.volumeAvailableCapacity,+ important: values?.volumeAvailableCapacityForImportantUsage+ )+ }++ /// What is free is the room macOS would make for an important file, which counts what it can purge. A volume+ /// that does not report that answers zero, and its plain free space is then what is free.+ static func storage(total: Int?, available: Int?, important: Int64?) -> Storage {+ let important = important ?? 0+ return Storage(total: Int64(total ?? 0), free: important > 0 ? important : Int64(available ?? 0))}static func sysctl(_ name: String) -> String? {diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swiftindex 95066427..2b3c5727 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swift@@ -44,6 +44,14 @@ struct DeviceInfoTests {#expect(DeviceInfo.Storage(total: 0, free: 0).usedFraction == 0)}+ /// What is free is the room macOS would make for an important file, which counts what it can purge. A volume+ /// that does not report that answers zero, and its plain free space is then what is free.+ @Test func freeSpaceIsThePlainFreeSpaceWhereTheVolumeDoesNotSayMore() {+ #expect(DeviceInfo.storage(total: 245_107_195_904, available: 48_015_052_800, important: 58_789_408_280).free == 58_789_408_280)+ #expect(DeviceInfo.storage(total: 536_829_952, available: 459_358_208, important: 0).free == 459_358_208)+ #expect(DeviceInfo.storage(total: nil, available: nil, important: nil) == DeviceInfo.Storage(total: 0, free: 0))+ }+@Test func leavesOutAZeroPatchVersion() {#expect(DeviceInfo.versionString(OperatingSystemVersion(majorVersion: 26, minorVersion: 7, patchVersion: 0)) == "26.7")#expect(DeviceInfo.versionString(OperatingSystemVersion(majorVersion: 26, minorVersion: 7, patchVersion: 1)) == "26.7.1")