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.

Know a Dropbox folder that syncs outside File Provider

Țugui Dragoș8763d0165290
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index e87ec79d..ab871ddb 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -211,8 +211,8 @@ A handful of ideas carry most of the weight. Each is enforced in one place and t
another app's container makes macOS ask for that app's data. A path is read name by name (`PathComponents`),
never as text, since a slash and a combining mark after it are one Swift `Character`. The guard also refuses
anything that syncs to other devices (`SyncedFolders`): what iCloud or a File Provider keeps, and what sits in a
- folder Syncthing, Resilio Sync, Synology Drive Client, or MEGA keeps in step, since the Trash would take it from
- those devices too. It looks a level or two inside a folder for a library, a wallet, or work kept only in a cache,
+ folder Syncthing, Resilio Sync, Synology Drive Client, MEGA, or Dropbox outside File Provider keeps in step, since
+ the Trash would take it from those devices too. It looks a level or two inside a folder for a library, a wallet, or work kept only in a cache,
and refuses a folder holding a folder macOS won't let Peel list, unless only the helper can move it, which looks
inside as root (`ProtectedData.Finding`).
- **Exclusions everywhere.** The user's exclusions reach every scanner, so an excluded item never appears, and
diff --git a/Packages/PeelCore/Sources/PeelCore/Support/SyncedFolders.swift b/Packages/PeelCore/Sources/PeelCore/Support/SyncedFolders.swift
index 71d23b33..6bbbce01 100644
--- a/Packages/PeelCore/Sources/PeelCore/Support/SyncedFolders.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Support/SyncedFolders.swift
@@ -9,8 +9,9 @@ import Synchronization
final class SyncedFolders: Sendable {
/// The entry each app keeps at the root of a folder it syncs: Syncthing's folder marker (`.stfolder`, its default
/// `markerName`), the share's identifier in Resilio Sync's `.sync` folder, Synology Drive Client's working folder,
- /// and the ignore file MEGA writes in every new sync (`src/sync.cpp` in meganz/sdk).
- static let markers = [".stfolder", ".sync/ID", ".SynologyWorkingDirectory", ".megaignore"]
+ /// the ignore file MEGA writes in every new sync (`src/sync.cpp` in meganz/sdk), and the cache Dropbox keeps in
+ /// its folder when it doesn't sync through File Provider (Dropbox's "How to clear the Dropbox cache folder").
+ static let markers = [".stfolder", ".sync/ID", ".SynologyWorkingDirectory", ".megaignore", ".dropbox.cache"]
private let answers = Mutex<[String: Bool]>([:])
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift
index 1ddddcf6..6da0f4fd 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift
@@ -295,6 +295,20 @@ struct DuplicateFinderTests {
#expect(DuplicateScan.canChange(local, in: group, selected: []))
}
+ @Test func aCopyInADropboxFolderOutsideFileProviderIsHeldBack() async throws {
+ let directory = try TemporaryDirectory()
+ let contents = randomData(count: 3_000)
+ try directory.directory("home/Dropbox/.dropbox.cache")
+ try directory.file("home/Dropbox/Shared/plan.bin", contents: contents)
+ try directory.file("home/Documents/plan.bin", contents: contents)
+
+ let scan = try await scan(directory, folders: ["home/Dropbox", "home/Documents"])
+ let group = try #require(scan.groups.first)
+
+ #expect(group.files.first { $0.url.pathComponents.contains("Dropbox") }?.heldBack == .inTheCloud)
+ #expect(scan.suggestedSelection.isEmpty)
+ }
+
/// A group whose every copy syncs is listed too, under its own heading in the app, with nothing to free.
@Test func listsAGroupWhoseEveryCopySyncs() async throws {
let directory = try TemporaryDirectory()
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SyncedFoldersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SyncedFoldersTests.swift
index da820992..6489bf55 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/SyncedFoldersTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/SyncedFoldersTests.swift
@@ -5,7 +5,10 @@ import Testing
struct SyncedFoldersTests {
@Test func knowsWhatEachSyncAppKeepsInStep() throws {
let directory = try TemporaryDirectory()
- let roots = ["Syncthing": ".stfolder/", "Resilio": ".sync/ID", "Synology": ".SynologyWorkingDirectory/", "MEGA": ".megaignore"]
+ let roots = [
+ "Syncthing": ".stfolder/", "Resilio": ".sync/ID", "Synology": ".SynologyWorkingDirectory/", "MEGA": ".megaignore",
+ "Dropbox": ".dropbox.cache/",
+ ]
for (root, marker) in roots {
if marker.hasSuffix("/") {
try directory.directory("home/\(root)/\(marker)")
diff --git a/SAFETY.md b/SAFETY.md
index c5b3b38a..fcf2d33f 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -79,11 +79,12 @@ two inside stays too, since moving the folder would take the library along, and
you press the button. A browser profile with a wallet in it stays the same way, and so does a folder that holds one a
level or two down: see [Crypto wallets](#crypto-wallets).
-Anything that syncs to your other devices stays too, wherever it is: what iCloud or another cloud service keeps, such
-as what is on your Desktop and in Documents when they are in iCloud Drive, and what is in a folder Syncthing, Resilio
-Sync, Synology Drive Client, or MEGA keeps in step, known by the entry each writes at that folder's root (`.stfolder`,
-`.sync/ID`, `.SynologyWorkingDirectory`, `.megaignore`). The Trash would take it from your other devices too. Its row
-says so, File Search doesn't list it, and Duplicates lists such a copy marked Stays, never selected and never moved.
+Anything that syncs to your other devices stays too, wherever it is: what iCloud or another cloud service keeps, such as
+what is on your Desktop and in Documents when they are in iCloud Drive, and what is in a folder Syncthing, Resilio Sync,
+Synology Drive Client, MEGA, or Dropbox outside File Provider keeps in step, known by the entry each writes at that
+folder's root (`.stfolder`, `.sync/ID`, `.SynologyWorkingDirectory`, `.megaignore`, `.dropbox.cache`). The Trash would
+take it from your other devices too. Its row says so, File Search doesn't list it, and Duplicates lists such a copy
+marked Stays, never selected and never moved.
Also refused: work that an app keeps inside a *cache* folder and nowhere else. A JetBrains IDE and Android Studio keep a
history of your changes in `LocalHistory`, beside their caches, which no repository may hold, Deno keeps `localStorage`