-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Exclude cache directories from iCloud Drive sync on macOS #16724
Copy link
Copy link
Closed
Labels
A-cachingArea: caching of dependencies, repositories, and build artifactsArea: caching of dependencies, repositories, and build artifactsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`O-macosOS: macOSOS: macOSS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review
Metadata
Metadata
Assignees
Labels
A-cachingArea: caching of dependencies, repositories, and build artifactsArea: caching of dependencies, repositories, and build artifactsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`O-macosOS: macOSOS: macOSS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
Currently, Cargo kindly excludes cache directories (e.g.,
target/) from Time Machine backups on macOS. For the same reasons, we should also prevent iCloud Drive from syncing these directories when a project is located in an iCloud-synced folder (e.g.,~/Desktopor~/Documents).Proposed Solution
We can simply add the iCloud exclusion property alongside the existing implementation of Time Machine exclusion:
cargo/crates/cargo-util/src/paths.rs
Lines 855 to 867 in 607b3eb
The key kCFURLUbiquitousItemIsExcludedFromSyncKey, introduced in macOS 11.3, tells iCloud Drive to ignore the directory. For compatibility, we can use the string value
"NSURLUbiquitousItemIsExcludedFromSyncKey".Following the existing pattern, we can safely set this property and keep it backward-compatible.
Notes
I would be happy to submit a PR for this if the team agrees!