Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.
Swift cache-cleanercleanmymaccleanupdisk-cleanerdisk-spacehomebrewmac-utilitymacosmacos-appmacos-cleanermacosxnativeossosxprivacyswiftswiftuisystem-cleanerxcode-cleaner
Fix ignored path normalization on macOS 15
momenbaselb399a4f0d6a1
diff --git a/cli/Sources/puremac/Core/Stores.swift b/cli/Sources/puremac/Core/Stores.swiftindex cce1ea6..73844f9 100644--- a/cli/Sources/puremac/Core/Stores.swift+++ b/cli/Sources/puremac/Core/Stores.swift@@ -123,11 +123,9 @@ struct IgnoreStore {guard allowRelative else {throw StoreError.invalidIgnorePath}- absolute = URL(fileURLWithPath: currentDirectoryPath, isDirectory: true)- .appendingPathComponent(expanded)- .path+ absolute = currentDirectoryPath + "/" + expanded}- let standardized = URL(fileURLWithPath: absolute).standardizedFileURL.path+ let standardized = try lexicalStandardizedAbsolutePath(absolute)guard standardized.hasPrefix("/"), standardized != "/",!standardized.unicodeScalars.contains(where: {$0.value == 0 || CharacterSet.newlines.contains($0)@@ -138,6 +136,22 @@ struct IgnoreStore {return standardized}+ private static func lexicalStandardizedAbsolutePath(_ path: String) throws -> String {+ guard path.hasPrefix("/") else {+ throw StoreError.invalidIgnorePath+ }+ var components: [Substring] = []+ for component in path.split(separator: "/") {+ if component == "." { continue }+ if component == ".." {+ if !components.isEmpty { components.removeLast() }+ continue+ }+ components.append(component)+ }+ return "/" + components.joined(separator: "/")+ }+private static func load(from fileURL: URL) throws -> [String] {guard FileManager.default.fileExists(atPath: fileURL.path) else { return [] }let contents = try String(contentsOf: fileURL, encoding: .utf8)diff --git a/cli/Sources/puremac/PureMac.swift b/cli/Sources/puremac/PureMac.swiftindex 83abbe3..e755d75 100644--- a/cli/Sources/puremac/PureMac.swift+++ b/cli/Sources/puremac/PureMac.swift@@ -1,7 +1,7 @@import ArgumentParserimport Foundation-let puremacVersion = "1.1.0"+let puremacVersion = "1.1.1"@mainstruct PureMac: ParsableCommand {diff --git a/cli/Tests/puremacTests/OptimizeConfigTests.swift b/cli/Tests/puremacTests/OptimizeConfigTests.swiftindex eae76f8..6dcdd03 100644--- a/cli/Tests/puremacTests/OptimizeConfigTests.swift+++ b/cli/Tests/puremacTests/OptimizeConfigTests.swift@@ -126,10 +126,19 @@ final class OptimizeConfigTests: XCTestCase {}XCTAssertTrue(store.roots.isEmpty)var rootStore = try IgnoreStore(fileURL: file, currentDirectoryPath: "/")- XCTAssertThrowsError(try rootStore.add("."))-- try Data("relative/path\n".utf8).write(to: file)- XCTAssertThrowsError(try IgnoreStore(fileURL: file))+ for path in [".", "/.", "/tmp/.."] {+ XCTAssertThrowsError(try rootStore.add(path))+ XCTAssertThrowsError(try rootStore.remove(path))+ }+ XCTAssertTrue(rootStore.roots.isEmpty)+ XCTAssertTrue(try rootStore.add("/tmp/./puremac-ignore-fixture"))+ XCTAssertEqual(rootStore.roots, ["/tmp/puremac-ignore-fixture"])+ XCTAssertTrue(try rootStore.remove("/tmp/puremac-ignore-fixture"))++ for contents in ["relative/path\n", "/.\n", "/tmp/..\n"] {+ try Data(contents.utf8).write(to: file)+ XCTAssertThrowsError(try IgnoreStore(fileURL: file))+ }}private func temporaryDirectory() throws -> URL {