Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Keep only the comments a reader needs

Țugui Dragoșa6b4c890db59
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift b/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift
index 39e21fda..437ba0d2 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift
@@ -28,8 +28,7 @@ public struct InstalledApp: Sendable, Hashable, Identifiable {
public let isUseRecorded: Bool
public let dateAdded: Date?
public let updateFeed: UpdateFeed?
- /// The folder electron-updater keeps the app's downloads in, as the app's own settings name it, or nil for an app
- /// without electron-updater (`ElectronUpdater`).
+ /// The folder electron-updater keeps this app's downloads in, as its `app-update.yml` names it.
public let updaterFolder: String?
/// Whether this is Peel, which is removed only from its own Settings, where the helper and the login item
/// are unregistered first. Also true for the bundle the running code sits inside, such as the Peel that
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift
index 577af413..f446c7bd 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift
@@ -305,7 +305,7 @@ public enum IntelInspector {
for case let item as URL in enumerator {
guard !Task.isCancelled else { break }
if driverExtensions.contains(item.pathExtension) {
- // After a file, `skipDescendants()` would skip the next folder's contents instead.
+ // `skipDescendants()` after a file would skip the next folder.
if (try? item.resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory == true {
enumerator.skipDescendants()
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index dfe94dca..43e7be19 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -547,7 +547,6 @@ public enum DeveloperCaches {
Folder("Library/Caches/electron", .downloads, source: "https://github.com/electron/get/blob/53178fdcbd62f0e229a4f9695632003637c0f35e/README.md#L123"),
Folder("Library/Caches/electron-builder", .downloads, source: "https://github.com/electron-userland/electron-builder/blob/ec9135d0626879479ffa4235006f06b14375cc43/website/docs/environment-variables.md#L166"),
Folder(".electron-gyp", .downloads, source: "https://github.com/electron/rebuild/blob/8b14ce89664a4d341afebb0e5964e912d4453b7f/src/constants.ts#L4"),
- // The cache older versions of electron-download used, before `@electron/get` replaced it.
Folder(".electron", .downloads, source: "https://unpkg.com/[email protected]/lib/index.js"),
]),
Definition(id: "nodegyp", name: "node-gyp", systemImage: "cube", appBundleIdentifiers: [], folders: [
@@ -748,8 +747,7 @@ public enum DeveloperCaches {
]),
Definition(id: "cabal", name: "Cabal", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
Folder(".cache/cabal", .downloads, source: "https://github.com/haskell/cabal/blob/cdb488e5ef41005cb1fa9a534708a459a6e98b2e/doc/config.rst#L112-L115"),
- // The same folders while Cabal still keeps everything in `~/.cabal`, beside its settings and what it
- // installed.
+ // Cabal's older layout, with everything in `~/.cabal`.
Folder(".cabal/packages", .downloads, source: "https://github.com/haskell/cabal/blob/cdb488e5ef41005cb1fa9a534708a459a6e98b2e/cabal-install/src/Distribution/Client/Config.hs#L771-L823"),
Folder(".cabal/script-builds", .buildData, source: "https://github.com/haskell/cabal/blob/cdb488e5ef41005cb1fa9a534708a459a6e98b2e/cabal-install/src/Distribution/Client/Config.hs#L771-L823"),
]),
@@ -819,8 +817,6 @@ public enum DeveloperCaches {
),
Folder("Library/Caches/com.microsoft.VSCode.ShipIt", .downloads, source: "https://github.com/Squirrel/Squirrel.Mac/blob/5c9e2133c09d6f8e2e3c5a45c5b0ffc00448c58a/Squirrel/SQRLUpdater.m#L814-L829"),
]),
- // Insiders keeps VS Code's folders under its own name, as Homebrew's cask for it and VS Code's troubleshooting
- // guide name it.
Definition(id: "vscodeinsiders", name: "Visual Studio Code - Insiders", systemImage: "curlybraces", appBundleIdentifiers: ["com.microsoft.VSCodeInsiders"], folders: [
Folder("Library/Application Support/Code - Insiders/Cache", .cache, source: "https://github.com/electron/electron/blob/df79406cecfd393f38d5a18b83379d4ba85cc29b/shell/browser/net/network_context_service.cc#L94-L95"),
Folder("Library/Application Support/Code - Insiders/CachedData", .cache, source: "https://github.com/microsoft/vscode/blob/0817aaa824590067854c361e77eb973a08b3cf48/src/mainImpl.ts#L649-L668"),
@@ -1181,7 +1177,7 @@ public enum DeveloperCaches {
]),
// Chromium's docs/user_data_dir.md names each Chrome channel's and Chromium's folder, brave-core's
// `build/config.gni` and `app/theme/*/BRANDING` each Brave build's folder and identifier, and Opera's desktop
- // blog names Opera's (blogs.opera.com/desktop/2023/08). Their disk caches are in `Library/Caches`, which Space
+ // blog Opera's (blogs.opera.com/desktop/2023/08). Their disk caches are in `Library/Caches`, which Space
// empties.
Definition(
id: "chrome", name: "Google Chrome", systemImage: "globe",
@@ -1244,8 +1240,7 @@ public enum DeveloperCaches {
identifiers + identifiers.map { $0 + "-EAP" }
}
- /// Where Chromium named its WebGPU cache `DawnCache`, before it renamed it `DawnWebGPUCache`. Nothing removes the
- /// folder an app wrote under the old name.
+ /// Chromium's WebGPU cache before it was renamed `DawnWebGPUCache`; nothing removes the old folder.
private static let formerWebGPUCache =
"https://github.com/chromium/chromium/blob/68b0fb2a9324b16f8d9c7fc91ef27fde78437821/gpu/ipc/common/gpu_disk_cache_type.cc#L42"
@@ -1349,8 +1344,7 @@ public enum DeveloperCaches {
}
}
- /// The name an editor built on VS Code keeps its data under: `nameShort` in the `product.json` its build ships,
- /// which VS Code passes to the path of its user data. Nil for an app that carries no such file.
+ /// `nameShort` in the app's `product.json`, the name VS Code keeps its data under.
private static func vsCodeProductName(of app: InstalledApp) -> String? {
let file = app.url.appending(path: "Contents/Resources/app/product.json")
guard let data = BoundedRead.data(at: file, maximum: 1_024 * 1_024),
@@ -1360,7 +1354,7 @@ public enum DeveloperCaches {
return name
}
- /// VS Code's own caches and logs in an editor's data folder, and the state of its workspaces that are gone.
+ /// Also the state of workspaces that are gone.
private static func vsCodesOwnFolders(in data: String) -> [Folder] {
let vsCode = "https://github.com/microsoft/vscode/blob/0817aaa824590067854c361e77eb973a08b3cf48/src/"
return [
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index e0e6f4a1..0a5d9eb6 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -81,9 +81,7 @@ public enum ProjectArtifacts {
var proof: Proof?
var keepsItsSetup = false
- /// The artifacts this kind names among the entries of `folder`: a name ending in `*` is a prefix, as CLion
- /// names a build folder for each profile, and a path names a folder inside one of them, as Rails keeps
- /// `tmp/cache`, or each one that begins so, as Trigger.dev keeps `.trigger/tmp-<branch>`.
+ /// Names ending in `*` are prefixes, and a path such as `tmp/cache` names a folder inside another.
func candidates(among names: Set<String>, in folder: URL) -> [String] {
let parts = PathComponents.of(name)
guard let first = parts.first, let last = parts.last else { return [] }
@@ -117,8 +115,7 @@ public enum ProjectArtifacts {
case holdsOnlyFilesEnding(String)
/// Nothing but entries with these names, `including` among them.
case holdsOnly(Set<String>, including: String)
- /// Nothing but folders named by a lowercase hexadecimal digest of this many characters, as Ruby Sass names
- /// each folder of its cache by the SHA-1 of the folder its stylesheet sits in.
+ /// Only folders named by a lowercase hexadecimal digest of this length, as Ruby Sass names its cache's.
case holdsOnlyFoldersNamedByDigest(characters: Int)
func holds(at url: URL) -> Bool {
@@ -281,8 +278,7 @@ public enum ProjectArtifacts {
name: ".serverless", markers: serverlessFiles, tool: "Serverless Framework", isGeneric: false,
source: "https://github.com/serverless/serverless/blob/de91219a8c8f28e07c308b2efc5187fae5445208/docs/sf/providers/aws/cli-reference/package.md#L16"
),
- // `.trigger` also keeps the dev session's state, so only its builds are offered: `tmp`, and `tmp-<branch>` for
- // a session on another branch.
+ // `.trigger` also keeps the dev session's state, so only its builds are offered.
Definition(
name: ".trigger/tmp", markers: ["trigger.config.ts", "trigger.config.mjs", "trigger.config.js"],
tool: "Trigger.dev", isGeneric: false,
@@ -359,8 +355,7 @@ public enum ProjectArtifacts {
name: "_site", markers: eleventyConfigFiles, tool: "Eleventy", isGeneric: true,
source: "https://github.com/11ty/eleventy/blob/c0bb3f4219e00629f4f58a771c1783c898b9bdab/src/Util/ProjectDirectories.js#L10-L15"
),
- // Other site generators name their output `_site` too, and Jekyll keeps there, from one build to the next,
- // whatever its `keep_files` setting names.
+ // `_site` is a generic name, and Jekyll keeps in it whatever its `keep_files` setting names.
Definition(
name: "_site", markers: jekyllConfigFiles, tool: "Jekyll", isGeneric: true,
source: "https://github.com/jekyll/jekyll/blob/541d8b2ee75c8907de4744d4b87a7a6f1f997cae/lib/jekyll/configuration.rb#L9-L12"
@@ -369,8 +364,7 @@ public enum ProjectArtifacts {
name: ".jekyll-cache", markers: jekyllConfigFiles, tool: "Jekyll", isGeneric: false,
source: "https://github.com/jekyll/jekyll/blob/541d8b2ee75c8907de4744d4b87a7a6f1f997cae/lib/jekyll/commands/clean.rb#L20-L31"
),
- // `.quarto` keeps only what Quarto makes again; the results a project chose to freeze are in `_freeze`, which
- // Quarto has the person keep in version control, so it is never listed.
+ // `_freeze` holds results a project keeps in version control, so it is never listed.
Definition(
name: ".quarto", markers: quartoProjectFiles, tool: "Quarto", isGeneric: false,
source: "https://github.com/quarto-dev/quarto-cli/blob/a57cc76458d91a0577c162a474929119e6b663ba/src/project/project-scratch.ts#L12-L24"
@@ -427,8 +421,7 @@ public enum ProjectArtifacts {
name: "project/target", markers: ["build.sbt"], tool: "sbt", isGeneric: true,
source: "https://www.scala-sbt.org/1.x/docs/Directories.html"
),
- // Beside what an export and a compile make again, `.bloop` keeps `bloop.settings.json`, the workspace settings
- // the person or an editor wrote there.
+ // `.bloop` also keeps `bloop.settings.json`, the workspace settings written there.
Definition(
name: ".bloop", markers: ["build.sbt", "build.sc", "build.mill", "pom.xml"] + gradleFiles, tool: "Bloop",
isGeneric: false,
@@ -723,8 +716,7 @@ public enum ProjectArtifacts {
name: ".terragrunt-cache", markers: ["terragrunt.hcl"], tool: "Terragrunt", isGeneric: false,
source: "https://docs.terragrunt.com/features/units/terragrunt-cache/"
),
- // `.aws-sam` also keeps the pipeline `sam pipeline bootstrap` set up (`pipeline/pipelineconfig.toml`), so only
- // the parts `sam build` and `sam sync` make again are offered.
+ // `.aws-sam` also keeps the pipeline `sam pipeline bootstrap` set up, so only build output is offered.
Definition(
name: ".aws-sam/build", markers: samProjectFiles, tool: "AWS SAM", isGeneric: false,
source: "https://github.com/aws/aws-sam-cli/blob/b73a020cc555abaf6c2cbd3b902b9c91558a3ad9/samcli/commands/_utils/constants.py#L8"
@@ -977,7 +969,6 @@ public enum ProjectArtifacts {
return (await withLastActivity(pending), next < queue.count, unreadable)
}
- /// An artifact the walk found, waiting for its project's last change.
private struct Pending: Sendable {
let url: URL
let project: URL
@@ -985,8 +976,7 @@ public enum ProjectArtifacts {
let contents: FolderContents?
}
- /// Reads each project's last change once, after the walk, passing by every artifact inside the project, its
- /// own and those of a project within it, since a build or a run writes into them while nobody works on it.
+ /// Builds write into artifacts while nobody works on a project, so its last change passes by every one inside.
private static func withLastActivity(_ pending: [Pending]) async -> [ProjectArtifact] {
let projects = Dictionary(
pending.map { (key(of: $0.project), $0.project) }, uniquingKeysWith: { first, _ in first }
@@ -1032,9 +1022,7 @@ public enum ProjectArtifacts {
}
}
- /// The project an artifact found without its tool's file belongs to: the nearest folder at or above `folder`,
- /// never above `root`, that holds a repository or a file a tool makes its project from, or else `folder`. Each
- /// folder asked about is read once a walk.
+ /// The nearest folder from `folder` up to `root` holding a repository or a tool's project file, else `folder`.
private static func project(
above folder: URL,
within root: URL,
@@ -1062,8 +1050,6 @@ public enum ProjectArtifacts {
}
}
- /// Whether a folder holding `names` is a project: a repository, or the place of a file a tool makes its project
- /// from.
static func holdsAProject(names: Set<String>, in folder: URL) -> Bool {
names.contains(".git")
|| definitions.contains { !$0.markers.isEmpty && $0.hasMarker(besides: names, in: folder) }
@@ -1079,7 +1065,6 @@ public enum ProjectArtifacts {
let name: String
let definition: Definition?
let isTaggedAsACache: Bool
- /// True when the file of the tool that makes it stands beside it, which makes that folder its project.
var isBesideItsToolsFile = false
}
@@ -1162,7 +1147,7 @@ public enum ProjectArtifacts {
let name = url.lastPathComponent
let relative = String(key(of: url).dropFirst(base.count + 1))
if artifacts.contains(name) || artifacts.contains(relative) || passedByForActivity.contains(name) {
- // After a file, as a submodule's `.git` is, `skipDescendants()` would skip the next folder instead.
+ // `skipDescendants()` after a file, such as a submodule's `.git`, would skip the next folder.
if (try? url.resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory == true {
enumerator.skipDescendants()
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
index e25ef1fa..67b92893 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
@@ -110,7 +110,7 @@ public enum HoldBack: String, Sendable, Hashable {
case openedFromMail
/// A report macOS wrote when the app crashed, which its developer may still ask for.
case crashReport
- /// It syncs to the cloud, and `RemovalGuard` refuses to move it: the Trash would remove it from every device.
+ /// It syncs to the cloud, so `RemovalGuard` refuses to move it.
case inTheCloud
/// A file a program has open right now, which may still be downloading it.
case openInAProgram
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift
index a638ac51..fb86b0a8 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift
@@ -46,9 +46,7 @@ struct LeftoverMatcher: Sendable {
)
}
- /// This app's claim on the folder electron-updater keeps its downloads in, which the app's own settings name:
- /// `url` directly in one of its places under `home` (`ElectronUpdater.places`), whatever the app is called. It is
- /// shared only with an app naming the same folder.
+ /// This app's claim on the folder its `app-update.yml` names for electron-updater's downloads.
func updatersFolder(at url: URL, home: String) -> LeftoverMatch? {
guard let folder = target.updaterFolder, url.lastPathComponent.lowercased() == folder else { return nil }
let parent = PathComponents.of(url.deletingLastPathComponent().path(percentEncoded: false))
@@ -358,8 +356,7 @@ extension LeftoverMatcher {
ownFolderNames = app.ownFolderNames
isApplesOwn = app.isSystemProtected || teamPrefix == Self.appleTeam
isASafariWebApp = app.isASafariWebApp
- // Only the name electron-builder writes, the app's and `-updater`: the settings are whoever built the
- // app's, and any other name could be a folder other programs share.
+ // Only electron-builder's `<name>-updater`: any other name could be a folder other programs share.
updaterFolder = app.updaterFolder.map { $0.lowercased() }.flatMap { $0.hasSuffix("-updater") ? $0 : nil }
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/CarriedSelection.swift b/Packages/PeelCore/Sources/PeelCore/Removal/CarriedSelection.swift
index 63bcbad5..e4974c2d 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/CarriedSelection.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/CarriedSelection.swift
@@ -37,7 +37,6 @@ public struct CarriedSelection: Sendable {
public var count: Int { sizes.count }
public var total: SizeTotal { SizeTotal(sizes.values) }
- /// The same part with only `sizes`, some of its own.
func keeping(_ sizes: [URL: Int64?]) -> Part {
Part(page: page, title: title, source: source, sourceKey: sourceKey, sizes: sizes)
}
@@ -79,15 +78,13 @@ public struct CarriedSelection: Sendable {
/// The pages seen so far, in the order they were first seen.
private var seen: [Page] = []
- /// A path as written, without a trailing slash, which two tools' URLs for one item share. Not `comparablePath`,
- /// which reads the disk, while the bar asks for the parts whenever a selection changes.
+ /// The path as written, without a trailing slash: `comparablePath` reads the disk, too slow for the bar.
static func writtenPath(of url: URL) -> Substring {
let path = url.path(percentEncoded: false)
return path.count > 1 && path.hasSuffix("/") ? path.dropLast() : Substring(path)
}
- /// The folders above `path`, each the part of it before a slash. Split at the slash byte, since a `Character`
- /// joins a slash and a combining mark after it.
+ /// The folders above `path`, split at the slash byte: a `Character` joins a slash and a combining mark.
static func folders(above path: Substring) -> some Sequence<Substring> {
path.utf8.indices.lazy.filter { $0 != path.startIndex && path.utf8[$0] == UInt8(ascii: "/") }.map { path[..<$0] }
}
@@ -103,8 +100,7 @@ public struct CarriedSelection: Sendable {
}
/// The parts that move: those of `candidates` whose page was seen and has something selected, in the order of
- /// `tools`, which is the sidebar's, and within a tool in the order its pages were seen. Each item is in one of
- /// them only (`eachItemOnce`), the part of the page `asking`, where Move to Trash is pressed, first.
+ /// `tools`, which is the sidebar's, and within a tool in the order its pages were seen.
public func parts(from candidates: [Part], order tools: [String], asking page: Page? = nil) -> [Part] {
func place(_ part: Part) -> (Int, Int) {
(tools.firstIndex(of: part.page.tool) ?? tools.count, seen.firstIndex(of: part.page) ?? seen.count)
@@ -113,10 +109,8 @@ public struct CarriedSelection: Sendable {
return Self.eachItemOnce(in: parts, asking: page)
}
- /// Two tools can list the same item, or one inside a folder the other lists, and an item selected on both pages
- /// would count and move twice. So an item inside a folder another part holds goes with that folder, an item two
- /// parts hold stays in the asking page's part or else the first, and a part left with nothing goes. One page's
- /// own selection is left as its tool made it.
+ /// Each item moves once: one inside a folder another part holds goes with that folder, one two parts hold stays in
+ /// the asking page's part or else the first. One page's own selection is left as its tool made it.
private static func eachItemOnce(in parts: [Part], asking page: Page?) -> [Part] {
guard parts.count > 1 else { return parts }
let paths = parts.map { part in part.sizes.keys.map { (url: $0, path: writtenPath(of: $0)) } }
@@ -139,8 +133,7 @@ public struct CarriedSelection: Sendable {
}
}
- /// Which parts hold the folders above a path, worked out once for each folder: the items of a selection share
- /// their folders, and the bar asks for the parts whenever a selection changes.
+ /// Which parts hold the folders above a path, worked out once per folder.
private struct FolderHolders {
private enum Holders {
case none, one(Int), several
@@ -161,7 +154,6 @@ public struct CarriedSelection: Sendable {
}
}
- /// The parts holding a folder above `path`, from those holding the folder above its own.
private mutating func holders(above path: Substring) -> Holders {
guard let slash = path.utf8.lastIndex(of: UInt8(ascii: "/")), slash != path.startIndex else { return .none }
let folder = path[..<slash]
@@ -197,8 +189,7 @@ extension Sequence where Element == CarriedSelection.Part {
public var itemCount: Int { reduce(0) { $0 + $1.count } }
public var total: SizeTotal { SizeTotal(flatMap(\.sizes.values)) }
- /// The parts holding an item in `moved`, or one inside a folder in it, each with only those items: what their
- /// tools have to bring up to date, whichever part moved it.
+ /// The parts holding an item in `moved` or inside a folder in it, each with only those items.
public func holding(_ moved: [URL]) -> [CarriedSelection.Part] {
let gone = Set(moved.map(CarriedSelection.writtenPath(of:)))
return compactMap { part in
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift
index 3f83a1fe..a542cfe1 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift
@@ -187,7 +187,7 @@ struct RemovalGuard: Sendable {
var info = stat()
let protectedFlags = UInt32(SF_RESTRICTED) | UInt32(SF_NOUNLINK)
guard lstat(path, &info) != 0 || info.st_flags & protectedFlags == 0 else { return .protectedLocation }
- // Moving what syncs to the cloud would remove it there and from every other device. Put Back removes nothing.
+ // Not for Put Back, which removes nothing from the cloud.
if item == nil, names.contains(where: { isInTheCloud(URL(filePath: $0)) }) { return .inTheCloud }
// Last, since each reads what is a level or two inside the folder, and a name refused above needs none of it.
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/SelectableRows.swift b/Packages/PeelCore/Sources/PeelCore/Removal/SelectableRows.swift
index e0121770..b9753528 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/SelectableRows.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/SelectableRows.swift
@@ -44,20 +44,17 @@ public struct SelectableRows<ID: Hashable> {
return selectable.filter { !recommended.contains($0) && !selection.contains($0) }
}
- /// What a box standing for every row shows, as a folder's box does for its files.
public func groupSelection(in selection: Set<ID>) -> GroupSelection {
if isNoneSelected(in: selection) { return .none }
return isAllSelected(in: selection) ? .all : .some
}
- /// A click on that box: what Peel recommends goes in, or, once all of it is selected, every row comes out. A row
- /// Peel doesn't recommend is selected only by its own box, or by Select All, which asks first.
+ /// A click on a group's box: what Peel recommends goes in, or, once all of it is selected, every row comes out.
public func clickingGroup(in selection: Set<ID>) -> Set<ID> {
recommended.allSatisfy(selection.contains) ? deselectingAll(in: selection) : selection.union(recommended)
}
}
-/// How many of a group's rows are selected, which its box shows as off, mixed, or on.
public enum GroupSelection: Sendable {
case none
case some
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/CloudFolders.swift b/Packages/PeelCore/Sources/PeelCore/Space/CloudFolders.swift
index 4d7aeab8..ce64cdb1 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/CloudFolders.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/CloudFolders.swift
@@ -1,11 +1,9 @@
public import Foundation
internal import PeelPrivileged
-/// The downloads in one folder of iCloud, with the names Finder shows from iCloud Drive or the app's folder down.
public struct CloudFolder: Sendable, Hashable, Identifiable {
public let url: URL
public let names: [String]
- /// The biggest first.
public let files: [CloudFile]
public let size: Int64
@@ -18,20 +16,17 @@ public struct CloudFolder: Sendable, Hashable, Identifiable {
size = files.map(\.size).cappedSum
}
- /// The folder with only those of its files in `urls`, as a search narrows it, or nil when it holds none of them.
public func keeping(_ urls: Set<URL>) -> CloudFolder? {
let kept = files.filter { urls.contains($0.url) }
return kept.isEmpty ? nil : CloudFolder(url: url, names: names, files: kept)
}
- /// The biggest first, and by name between two of the same size, so the order holds from one scan to the next.
public static func ordered(_ folders: [CloudFolder]) -> [CloudFolder] {
folders.sorted { $0.size != $1.size ? $0.size > $1.size : $0.names.lexicographicallyPrecedes($1.names) }
}
}
extension CloudStorage {
- /// `files` in the folders they sit in.
static func folders(of files: [CloudFile], home: URL) -> [CloudFolder] {
let root = home.appending(path: "Library/Mobile Documents", directoryHint: .isDirectory)
let grouped = Dictionary(grouping: files) {
@@ -44,8 +39,7 @@ extension CloudStorage {
})
}
- /// The container's name, then each folder's below it as Finder shows it. Finder shows an app's `Documents` as the
- /// app's folder itself, so that name is left out.
+ /// Finder shows an app's `Documents` as the app's folder itself, so that name is left out.
static func names(of folder: URL, container: String, under root: URL) -> [String] {
let rootNames = PathComponents.of(PathPattern.comparablePath(of: root))
let names = PathComponents.of(PathPattern.comparablePath(of: folder))
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
index 1827091e..74e24ffc 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
@@ -31,7 +31,6 @@ public struct CloudScan: Sendable {
/// How many downloads were left out because another copy on this Mac shares their space: each takes at least
/// `CloudStorage.minimumSize` on disk, yet removing it would free less.
public var sharedDownloads = 0
- /// `files` in the folders Finder shows them in, the folder whose downloads take the most first.
public var folders: [CloudFolder] = []
}
@@ -258,7 +257,7 @@ public enum CloudStorage {
let isAppsOwnData = enumerator.level == 2 && !isICloudDrive
&& url.lastPathComponent.caseInsensitiveCompare("Documents") != .orderedSame
if isAppsOwnData || isDataless(url) {
- // After a file, `skipDescendants()` would skip the next folder's contents instead.
+ // `skipDescendants()` after a file would skip the next folder.
if (try? url.resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory == true {
enumerator.skipDescendants()
}
@@ -364,9 +363,8 @@ public enum CloudStorage {
return (contents.size, contents.taken, modified)
}
- /// The readable name of the iCloud folder that holds `url`: "iCloud Drive" for `com~apple~CloudDocs`, and for an
- /// app's folder the name macOS shows, which the app chooses, else the last part of the folder's identifier, so
- /// `iCloud~com~acme~App` reads "App".
+ /// "iCloud Drive" for `com~apple~CloudDocs`; for an app's folder the name macOS shows, else the identifier's last
+ /// part, so `iCloud~com~acme~App` reads "App".
static func containerName(of url: URL, under root: URL) -> String {
let rootNames = PathComponents.of(PathPattern.comparablePath(of: root))
let names = PathComponents.of(PathPattern.comparablePath(of: url))
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
index 3fcafa6f..c00238ce 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
@@ -460,11 +460,9 @@ public enum Installers {
return items
}
- /// The updates apps downloaded and keep until they install them: in `~/Library/Caches`, Sparkle's folder inside
- /// the app's own, `<identifier>/org.sparkle-project.Sparkle` (`SPULocalCacheDirectory.m`, which adds `.sparkle`
- /// to an identifier ending like a bundle), and Squirrel's `<identifier>.ShipIt` (`SQRLShipItLauncher.m`); there
- /// and in its former place, electron-updater's folder (`ElectronUpdater`). A folder the Developer table lists is
- /// left to Developer.
+ /// Sparkle's `<identifier>/org.sparkle-project.Sparkle`, with `.sparkle` after an identifier that ends like a
+ /// bundle (`SPULocalCacheDirectory.m`), Squirrel's `<identifier>.ShipIt` (`SQRLShipItLauncher.m`), and
+ /// electron-updater's folder. A folder Developer lists is left to Developer.
static func updateDownloads(
home: URL,
installedApps: [InstalledApp],
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift
index c118c394..03165bd9 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift
@@ -108,11 +108,9 @@ public enum SpaceRemoval {
)
}
- /// How long a cache counts as in use after something wrote to it.
static let stillInUse: TimeInterval = 15 * 60
- /// True when `child` or anything inside it was written within `stillInUse`. A walk dates what is inside, and the
- /// folder's own date moves when an entry is added or removed.
+ /// The folder's own date counts too: it moves when an entry is added or removed.
private static func wasWrittenRecently(_ child: URL, contents: FolderContents?) -> Bool {
let own = (try? child.resourceValues(forKeys: [.contentModificationDateKey]))?.contentModificationDate
guard let written = [own, contents?.newestChange].compactMap(\.self).max() else { return false }
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift
index 97e75405..7f07dc2e 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift
@@ -31,8 +31,7 @@ public struct SpaceItem: Sendable, Hashable, Identifiable {
/// True when what macOS keeps in its folders for its own services is neither measured nor offered: there they run
/// as other accounts, whose open files Peel cannot see, or keep caches not even Full Disk Access can read.
public var leavesMacOSsOwn = false
- /// True when a child something wrote to in the last few minutes is held back (`SpaceRemoval.stillInUse`): Peel
- /// knows an open app's caches only by the app's names, and a program may write under a name of its own.
+ /// A child something wrote to in the last few minutes is held back (`SpaceRemoval.stillInUse`).
public var holdsBackRecentWrites = false
/// The folders of `urls` where macOS files reports into folders of its own, so only their files are offered.
public var onlyFilesIn: [URL] = []
diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/ElectronUpdater.swift b/Packages/PeelCore/Sources/PeelCore/Updates/ElectronUpdater.swift
index 18c0d68c..9df21ea1 100644
--- a/Packages/PeelCore/Sources/PeelCore/Updates/ElectronUpdater.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Updates/ElectronUpdater.swift
@@ -1,29 +1,22 @@
import Foundation
enum ElectronUpdater {
- /// Where electron-updater kept an app's downloads before version 6, relative to the home folder. Since then they
- /// are in `~/Library/Caches` (`AppAdapter.ts`).
+ /// Where electron-updater kept downloads before version 6, which keeps them in `Library/Caches` (`AppAdapter.ts`).
static let formerPlace = "Library/Application Support/Caches"
- /// Both places, relative to the home folder.
static let places = ["Library/Caches", formerPlace]
- /// The app's electron-updater settings, `Resources/app-update.yml` in `contents`, or nil when it has none. A real
- /// one is a few lines, so anything over 64 KB, or anything that is not a regular file, is ignored.
+ /// A real `app-update.yml` is a few lines, so one over 64 KB is ignored.
static func configuration(in contents: URL) -> String? {
BoundedRead.data(at: contents.appending(path: "Resources/app-update.yml"), maximum: 64 * 1_024)
.map { String(decoding: $0, as: UTF8.self) }
}
- /// The folder the settings name for the app's downloads (`updaterCacheDirName`, which electron-builder writes as
- /// the app's name and `-updater`).
static func downloadsFolder(fromConfiguration text: String) -> String? {
guard let name = topLevelFields(in: text)["updaterCacheDirName"], !name.contains("/"), name != ".", name != ".."
else { return nil }
return name
}
- /// Whether `folder` holds what electron-updater writes there: `update.zip`, the last update, kept for the next
- /// differential download, or `pending/update-info.json`, beside the update it downloaded.
static func holdsADownload(_ folder: URL) -> Bool {
["update.zip", "pending/update-info.json"].contains { name in
var info = stat()
diff --git a/Packages/PeelCore/Sources/PeelPrivileged/ProtectedData.swift b/Packages/PeelCore/Sources/PeelPrivileged/ProtectedData.swift
index 9d696b3b..ba0c8f4a 100644
--- a/Packages/PeelCore/Sources/PeelPrivileged/ProtectedData.swift
+++ b/Packages/PeelCore/Sources/PeelPrivileged/ProtectedData.swift
@@ -197,9 +197,8 @@ public enum ProtectedData: Sendable {
"Library/Nano/backup",
]
- /// What iCloud and File Provider keep about the files on this Mac and in the cloud, and the containers of macOS's
- /// own services, iCloud's among them. The services that keep these hold them open and make them again, and
- /// removing one, or putting an old copy back, leaves iCloud Drive's records disagreeing with the files.
+ /// iCloud's and File Provider's records of the files here and in the cloud, and macOS's own services' containers:
+ /// their services hold them open, and removing one or putting an old copy back leaves those records wrong.
static let cloudState = [
"Library/Application Support/CloudDocs",
"Library/Application Support/FileProvider",
@@ -209,13 +208,11 @@ public enum ProtectedData: Sendable {
"Library/Caches/com.apple.cloudd",
]
- /// How the caches of File Provider's and CloudKit's own programs begin in a home's `Library/Caches`: Apple names
- /// each of them for its program and adds programs between releases, so they are known by that start. Lowercase.
+ /// How File Provider's and CloudKit's caches begin, since Apple adds programs between releases. Lowercase.
private static let cloudStateCaches = ["com.apple.fileprovider", "com.apple.cloudkit"]
- /// Every protected place named from a home folder: `homeFolders`, `homeKeys`, `walletKeys` and `cloudState`.
- /// `refuses`, `holds` and `RemovalGuard` all read it, so a place added to one of those lists is protected by all
- /// three.
+ /// Every protected place named from a home folder (`homeFolders`, `homeKeys`, `walletKeys`, `cloudState`), which
+ /// `refuses`, `holds` and `RemovalGuard` all read, so a place added to one of them is protected by all three.
public static let homeTrees = homeFolders + homeKeys + walletKeys + cloudState
/// Hidden items in the home folder that belong to no single app: shells, git, and the folders many tools
@@ -373,7 +370,6 @@ public enum ProtectedData: Sendable {
private struct Branch {
var endsATree = false
- /// A name in this folder that begins with one of these is a tree too.
var beginnings: [String] = []
var next: [String: Branch] = [:]
@@ -387,8 +383,7 @@ public enum ProtectedData: Sendable {
}
}
- /// `trees` are named in full; in each folder of `beginnings`, every name that begins with one of its starts is
- /// a tree.
+ /// In each folder of `beginnings`, every name that begins with one of its starts is a tree too.
init(_ trees: [[String]], beginnings: [(folder: [String], starts: [String])] = []) {
var root = Branch()
for tree in trees {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AppExtensionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AppExtensionsTests.swift
index 5827eb4a..e58fca89 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/AppExtensionsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/AppExtensionsTests.swift
@@ -215,7 +215,6 @@ struct AppExtensionsTests {
#expect(path.hasSuffix(".systemextension/") || path.hasSuffix(".dext/"), "\(item.identifier) is at \(path)")
#expect(FileManager.default.fileExists(atPath: path), "\(item.identifier) is at \(path), which isn't there")
#expect(item.reportedState?.isEmpty == false, "\(item.identifier) reported no state")
- // When Finder moves the app, macOS forgets which app it was and removes the extension at the next restart.
#expect(
item.owner != nil || item.election == .beingRemoved,
"nothing says which app brought \(item.identifier)"
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AttackRemovalGuardTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AttackRemovalGuardTests.swift
index f3b5367d..4c025005 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/AttackRemovalGuardTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/AttackRemovalGuardTests.swift
@@ -606,8 +606,6 @@ struct AttackRemovalGuardTests {
}
}
- /// What syncs to the cloud stays wherever it is, as Desktop and Documents do in iCloud Drive: the Trash would
- /// take it from the cloud and from every other device. Put Back still brings an item there.
@Test func whatSyncsToTheCloudStaysWhereverItIs() throws {
let directory = try TemporaryDirectory()
let home = directory.url.appending(path: "home", directoryHint: .isDirectory)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CarriedSelectionTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CarriedSelectionTests.swift
index ae3dfe0e..6239f99f 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CarriedSelectionTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CarriedSelectionTests.swift
@@ -148,8 +148,6 @@ struct CarriedSelectionTests {
#expect(Set(pass.refused.flatMap(\.sizes.keys).map(\.lastPathComponent)) == ["com.apple.akd", "Kept.app"])
}
- /// Two tools can list the same item, as App Caches and Downloaded Updates both list an updater's folder: it
- /// counts and moves once, with the first part, and a part left with nothing goes.
@Test func anItemTwoPagesSelectedCountsOnce() {
var selection = CarriedSelection()
selection.saw(Page(tool: "installers", scope: "updateDownload"))
@@ -166,7 +164,6 @@ struct CarriedSelectionTests {
#expect(parts.last.map { Set($0.sizes.keys.map(\.lastPathComponent)) } == ["org.example.app"])
}
- /// A shared item counts with the page Move to Trash is pressed on, when that page holds it.
@Test func anItemTwoPagesSelectedCountsWithThePageAsking() {
var selection = CarriedSelection()
selection.saw(Page(tool: "installers", scope: "updateDownload"))
@@ -180,7 +177,6 @@ struct CarriedSelectionTests {
#expect(parts.map(\.page.scope) == ["caches"])
}
- /// An item inside a folder another page selected moves with that folder, whichever page comes first.
@Test func anItemInsideAFolderAnotherPageSelectedCountsWithTheFolder() {
var selection = CarriedSelection()
selection.saw(Page(tool: "installers", scope: "updateDownload"))
@@ -195,7 +191,6 @@ struct CarriedSelectionTests {
#expect(parts.total.known == 900)
}
- /// One page's own selection is left as its tool made it.
@Test func onePagesSelectionIsLeftAsItIs() {
var selection = CarriedSelection()
selection.saw(Page(tool: "space", scope: "caches"))
@@ -207,7 +202,6 @@ struct CarriedSelectionTests {
#expect(parts.itemCount == 2)
}
- /// A page's own folder and an item inside it stay as its tool made them when another page carries a selection too.
@Test func aPagesOwnFolderAndItsItemStayBesideAnotherPage() {
var selection = CarriedSelection()
selection.saw(Page(tool: "installers", scope: "updateDownload"))
@@ -221,7 +215,6 @@ struct CarriedSelectionTests {
#expect(parts.itemCount == 3)
}
- /// An item under folders two other pages selected moves with the outermost, whichever page asks.
@Test func anItemUnderFoldersTwoPagesSelectedMovesWithTheOutermost() {
var selection = CarriedSelection()
selection.saw(Page(tool: "installers", scope: "updateDownload"))
@@ -239,8 +232,6 @@ struct CarriedSelectionTests {
#expect(parts.total.known == 950)
}
- /// After a pass, every part that holds an item that moved, or one inside a folder that moved, so its tool is
- /// brought up to date even when another page moved it.
@Test func findsThePartsHoldingWhatMoved() {
let parts = [
part("installers", "updateDownload", ["Library/Caches/notes-updater": 300]),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
index ecb2cfbd..e62d816c 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
@@ -103,7 +103,6 @@ struct CloudStorageTests {
#expect(CloudStorage.containerName(of: URL(filePath: "/somewhere/else"), under: root) == "")
}
- /// An app's iCloud folder is named as macOS shows it, which the app chooses, on this Mac's own folders.
@Test func namesAnAppsFolderAsMacOSShowsIt() {
let root = URL.homeDirectory.appending(path: "Library/Mobile Documents", directoryHint: .isDirectory)
let containers = (try? FileManager.default.contentsOfDirectory(at: root, includingPropertiesForKeys: nil)) ?? []
@@ -116,8 +115,6 @@ struct CloudStorageTests {
}
}
- /// Each download goes in the folder Finder shows it in, named from iCloud Drive or the app's folder down, an
- /// app's `Documents` shown as the app's folder itself. A search keeps a folder only with the files it found.
@Test func groupsTheDownloadsByTheFolderFinderShowsThemIn() throws {
let directory = try TemporaryDirectory()
let root = directory.url.appending(path: "Library/Mobile Documents", directoryHint: .isDirectory)
@@ -334,7 +331,6 @@ struct CloudStorageTests {
#expect(collector.collected.files.isEmpty)
}
- /// In an app's iCloud folder only `Documents` is what Finder shows; the rest is the app's own data.
@Test func listsOnlyWhatFinderShows() throws {
let directory = try TemporaryDirectory()
let cloud = "Library/Mobile Documents"
@@ -353,7 +349,6 @@ struct CloudStorageTests {
#expect(collector.collected.files.map(\.name).sorted() == ["Note.bin", "Shared.bin", "Song.mp3"])
}
- /// A file whose download was removed holds nothing here, and the folder after it is still looked into.
@Test func looksIntoTheFolderAfterAFileWhoseDownloadWasRemoved() throws {
let directory = try TemporaryDirectory()
let drive = "Library/Mobile Documents/com~apple~CloudDocs"
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index e138d4b4..1565aa6e 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -301,7 +301,6 @@ struct DeveloperCachesTests {
#expect(listed("org.example.chat") == ["GPUCache"])
}
- /// `.` or `..` for a name, in the bundle or in `product.json`, names no folder of the app's own.
@Test func neverReadsAFolderAboveApplicationSupportAsAnElectronAppsData() throws {
let directory = try TemporaryDirectory()
let home = directory.url.appending(path: "home", directoryHint: .isDirectory)
@@ -373,7 +372,6 @@ struct DeveloperCachesTests {
])
}
- /// Chromium named its WebGPU cache `DawnCache` until 2024 and leaves the folder it wrote under that name behind.
@Test func listsTheWebGPUCacheUnderItsFormerName() async throws {
let directory = try TemporaryDirectory()
let home = directory.url.appending(path: "home", directoryHint: .isDirectory)
@@ -513,15 +511,13 @@ struct DeveloperCachesTests {
".minikube", ".minikube/cache/images", ".vagrant.d", "Library/Application Support/Jan/data", "Library/Caches/ollama",
// Unity keeps its licenses beside its caches; SonarScanner the client certificates it signs in with.
"Library/Unity", ".sonar",
- // Claude Code and Codex keep every conversation and prompt beside their caches and logs; Continue its
- // configuration and sessions, Cline its sessions and the API keys in `data/settings`.
+ // Each keeps conversations, settings, or keys beside its caches.
".claude", ".codex", ".continue", ".cline", ".cline/data",
]
// CocoaPods' spec repositories hold the ones a person added, which can carry unpushed work: only the copies of
// the public index are listed, the CDN's `trunk` and the Git clone CocoaPods names `master` or `cocoapods`,
// which is the tool's only when its origin is that index. nvm's, pyenv's, rbenv's and rustup's folders hold
- // every version they installed; only their download caches are caches, and rustup's temporary folder, which
- // `rustup update` empties.
+ // every version they installed; only their download caches are caches, and rustup's `tmp`.
let onlyTheseParts: [String: Set<String>] = [
".cocoapods/repos": [".cocoapods/repos/trunk", ".cocoapods/repos/master", ".cocoapods/repos/cocoapods"],
".nvm": [".nvm/.cache"], ".pyenv": [".pyenv/cache"], ".rbenv": [".rbenv/cache"],
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileSearchTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileSearchTests.swift
index 637a3ace..d9ac5506 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/FileSearchTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileSearchTests.swift
@@ -123,8 +123,6 @@ struct FileSearchTests {
#expect(!results.isTruncated)
}
- /// A file that syncs to the cloud, as Desktop and Documents do in iCloud Drive, is never listed, since the guard
- /// refuses it. A temporary folder holds no such file, so which one syncs is given here, as macOS would answer.
@Test func neverListsAFileThatSyncsToTheCloud() throws {
let directory = try TemporaryDirectory()
let home = directory.url.appending(path: "home", directoryHint: .isDirectory)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
index 7ce082a5..1faa30e1 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
@@ -285,7 +285,6 @@ struct InstallersTests {
#expect(scan.items.map(\.name) == ["Other-2.dmg"])
}
- /// What syncs to the cloud is listed and cannot be selected: the guard refuses to move it.
@Test func anInstallerThatSyncsToTheCloudCannotBeSelected() async throws {
let directory = try TemporaryDirectory()
try directory.file("Documents/Tool-2.dmg", bytes: 400_000)
@@ -439,8 +438,6 @@ struct InstallersTests {
#expect(items["com.apple.finder.ShipIt"]?.heldBack == .appIsRunning)
}
- /// electron-updater keeps what it downloads in the folder its app's `app-update.yml` names, in `~/Library/Caches`,
- /// or in `~/Library/Application Support/Caches` before electron-updater 6.
@Test func findsWhatElectronUpdaterDownloadedInEitherPlace() async throws {
let directory = try TemporaryDirectory()
let old = "Library/Application Support/Caches"
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift
index 3f68a195..f8ae59f1 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift
@@ -90,7 +90,6 @@ struct IntelInspectorTests {
#expect(walked.1.isEmpty)
}
- /// A file named like a bundle, as `git bundle` writes one, has nothing inside, and the folder after it is walked.
@Test func walksTheFolderAfterAFileNamedLikeABundle() throws {
let directory = try TemporaryDirectory()
try directory.file("Printers/Backup.bundle", bytes: 16)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
index d822969a..c0113afc 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
@@ -125,9 +125,6 @@ struct LeftoverScannerTests {
/// Another copy of an app that macOS knows outside the Applications folders uses the same files. Every Mac has one
/// of the character palette in its input methods folder, so a copy of it in Applications shares its settings, and
/// that copy is counted once when the list of apps holds it too.
- /// electron-updater keeps an app's downloads in the folder the app's own settings name, in `~/Library/Caches` or
- /// its former place in Application Support, whatever the app is called. Only electron-builder's own shape of
- /// name claims a folder, and only in those two places.
@Test func findsTheFolderTheAppsUpdaterKeepsItsDownloadsIn() async throws {
let directory = try TemporaryDirectory()
try directory.file("home/Library/Caches/tide2-updater/update.zip", bytes: 4096)
@@ -154,7 +151,6 @@ struct LeftoverScannerTests {
#expect(!kelps.contains { $0.url.lastPathComponent == "Shared" })
}
- /// Another copy of the app names the same folder, so the folder stays with it.
@Test func anUpdaterFolderAnotherCopyNamesStaysWithIt() async throws {
let directory = try TemporaryDirectory()
try directory.file("home/Library/Caches/tide2-updater/update.zip", bytes: 4096)
@@ -1095,8 +1091,6 @@ struct LeftoverScannerTests {
#expect(await leftover(photos, .applicationSupport).match.heldBack == .holdsALibrary)
}
- /// What syncs to the cloud, as a cask's folder in Documents does in iCloud Drive, cannot be selected, since the
- /// guard refuses it. A temporary folder holds no such folder, so which one syncs is given here.
@Test func aLeftoverThatSyncsToTheCloudCannotBeSelected() async throws {
let directory = try TemporaryDirectory()
let synced = try directory.directory("home/Documents/Example")
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
index 013b2bd1..e66c4585 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
@@ -1274,7 +1274,6 @@ struct ProjectArtifactsTests {
#expect(!artifact.isRecommended)
}
- /// A submodule's or a worktree's `.git` is a file, and the folder read after it is still read.
@Test func readsTheFolderAfterAGitFile() throws {
let directory = try TemporaryDirectory()
try directory.file("Project/package.json", bytes: 16)
@@ -1295,7 +1294,6 @@ struct ProjectArtifactsTests {
#expect(activity.isCertain)
}
- /// A quiet project of a few thousand files is read to the end, so what a build left deep inside it is suggested.
@Test func readsAQuietProjectOfThousandsOfFilesToTheEnd() async throws {
let directory = try TemporaryDirectory()
try directory.file("lib/pyproject.toml", bytes: 16)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift
index 12a1ff8e..365b4bb3 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift
@@ -120,9 +120,6 @@ struct SelectableRowsTests {
#expect(!locked.isNoneSelected(in: [repository]))
}
- /// One box for a group of rows, as a folder's for its files: it shows none, some, or every row selected. A click
- /// adds what Peel recommends, or, once all of that is selected, takes the whole group out, so it never selects a
- /// row Peel doesn't recommend.
@Test func aGroupsBoxSelectsWhatPeelRecommends() {
let group = SelectableRows(
rows: [cache, log, repository], selectable: [cache, log, repository], recommended: [cache, log]
diff --git a/Peel/Model/CloudLibrary.swift b/Peel/Model/CloudLibrary.swift
index 610379ab..78297190 100644
--- a/Peel/Model/CloudLibrary.swift
+++ b/Peel/Model/CloudLibrary.swift
@@ -17,7 +17,6 @@ final class CloudLibrary {
/// The last search and what it found. A view asks again whenever it is drawn, a checkbox included.
@ObservationIgnored private var lastMatch: (query: String, files: [CloudFile])?
@ObservationIgnored private var sizes: [URL: Int64] = [:]
- /// `files` in the folders Finder shows them in, from the same scan.
private(set) var folders: [CloudFolder] = [] {
didSet { lastFolders = nil }
}
@@ -51,7 +50,6 @@ final class CloudLibrary {
return found
}
- /// The folders holding the files `query` finds, each with only those files; every folder for an empty one.
func folders(matching query: String) -> [CloudFolder] {
guard !query.isEmpty else { return folders }
if let lastFolders, lastFolders.query == query { return lastFolders.folders }
diff --git a/Peel/Views/Cloud/CloudFolderRow.swift b/Peel/Views/Cloud/CloudFolderRow.swift
index e6a2fc63..338de807 100644
--- a/Peel/Views/Cloud/CloudFolderRow.swift
+++ b/Peel/Views/Cloud/CloudFolderRow.swift
@@ -1,8 +1,6 @@
import PeelCore
import SwiftUI
-/// A folder of the iCloud Drive page: its box selects the downloads in it Peel recommends, and the rest of the row
-/// opens the folder to list them under it.
struct CloudFolderRow: View {
@Environment(\.accessibilityReduceMotion) private var reduceMotion
let folder: CloudFolder
@@ -42,10 +40,9 @@ struct CloudFolderRow: View {
.frame(width: Self.chevronWidth)
AppIcon(url: folder.url)
.frame(width: 18, height: 18)
- // Centers the icon on the first line of text, as a file's row does.
.alignmentGuide(.firstTextBaseline) { $0[.bottom] - 4 }
.frame(width: 20)
- // Finder's own separator between the folders of a path, the same in every language Peel speaks.
+ // Finder's path separator, the same in every language Peel speaks.
Text(verbatim: folder.names.joined(separator: " ▸ "))
.lineLimit(1)
.truncationMode(.middle)
diff --git a/Peel/Views/Cloud/CloudView.swift b/Peel/Views/Cloud/CloudView.swift
index f526639b..e1cb03cb 100644
--- a/Peel/Views/Cloud/CloudView.swift
+++ b/Peel/Views/Cloud/CloudView.swift
@@ -14,7 +14,7 @@ struct CloudView: View {
@State private var leftAlone: LeftAlone?
@State private var isRescanning = false
@State private var searchText = ""
- /// The folders opened while browsing. While a search runs, each folder with a match is open unless closed in it.
+ /// Opened while browsing; during a search every folder with a match is open unless closed.
@State private var opened: Set<URL> = []
@State private var closedInSearch: Set<URL> = []
@@ -209,7 +209,6 @@ struct CloudView: View {
}
}
- /// Every file a click can select, and those Peel recommends: all but the desktop picture, which macOS holds open.
private func selectableRows(_ files: [CloudFile]) -> SelectableRows<URL> {
SelectableRows(
rows: files.map(\.url),
diff --git a/Peel/Views/NativeCheckbox.swift b/Peel/Views/NativeCheckbox.swift
index 084f72c7..c8785953 100644
--- a/Peel/Views/NativeCheckbox.swift
+++ b/Peel/Views/NativeCheckbox.swift
@@ -9,7 +9,6 @@ struct NativeCheckbox: NSViewRepresentable {
let label: String
var help: String?
var hint: String?
- /// Shows the box as mixed, as one standing for several rows does while only some of them are selected.
var isMixed = false
func makeCoordinator() -> Coordinator {
@@ -89,7 +88,7 @@ struct NativeCheckbox: NSViewRepresentable {
}
@objc func toggle(_ button: NSButton) {
- // A box that allows mixed goes from off to mixed on a click (`NSButton.h`), so only off reads as off.
+ // With mixed allowed, a click on off goes to mixed (`NSButton.h`).
isOn.wrappedValue = button.state != .off
}
}
diff --git a/Peel/Views/RemovalRow.swift b/Peel/Views/RemovalRow.swift
index 81de7819..6c2d1b87 100644
--- a/Peel/Views/RemovalRow.swift
+++ b/Peel/Views/RemovalRow.swift
@@ -7,7 +7,7 @@ struct RemovalRow: View {
}
let url: URL
- /// The item's name, shown and spoken in place of its path when the row sits under its folder.
+ /// Shown in place of the path, for a row under its folder.
var name: String?
let icon: Icon
let detail: LocalizedStringResource?