@@ -70,6 +70,9 @@ struct AppContext {
70
70
/// UserDefaults key indicating which policy to use fo handle duplicate files on the destination device.
71
71
private static let duplicateFilesHandlingPolicyKey : String = " duplicateFilesHandlingPolicy "
72
72
73
+ /// UserDefaults key indicating the list of paths to exclude during file discovery
74
+ private static let excludedPathsListKey : String = " excludedPathsList "
75
+
73
76
/// UserDefaults key indicating whether the app should skip the device reboot step after migration.
74
77
static let skipRebootUserDefaultsKey : String = " skipDeviceReboot "
75
78
@@ -105,11 +108,16 @@ struct AppContext {
105
108
static var duplicateFilesHandlingPolice : DuplicateFilesHandlingPolicy {
106
109
return DuplicateFilesHandlingPolicy ( rawValue: UserDefaults . standard. string ( forKey: Self . duplicateFilesHandlingPolicyKey) ?? " overwrite " ) ?? . overwrite
107
110
}
108
-
111
+ static var urlExclusionsList : [ URL ? ] {
112
+ let managedExcludedPaths = UserDefaults . standard. array ( forKey: Self . excludedPathsListKey) as? [ String ] ?? [ ]
113
+ let managedExcludedURLs = managedExcludedPaths. compactMap { URL ( string: $0) }
114
+ return managedExcludedURLs + defaultUrlExclusionList
115
+ }
116
+
109
117
// MARK: - File Scan Variables
110
-
111
- /// Custom list of paths tha needs to be ignored during file discovery.
112
- static var urlExclusionList : [ URL ? ] = [ FileManager . default. urls ( for: . libraryDirectory, in: . userDomainMask) . first,
118
+
119
+ /// Custom list of paths that needs to be ignored during file discovery.
120
+ static var defaultUrlExclusionList : [ URL ? ] = [ FileManager . default. urls ( for: . libraryDirectory, in: . userDomainMask) . first,
113
121
FileManager . default. urls ( for: . applicationDirectory, in: . localDomainMask) . first? . appendingPathComponent ( " \( Bundle . main. name) .app " ) ,
114
122
FileManager . default. urls ( for: . applicationDirectory, in: . localDomainMask) . first? . appendingPathComponent ( " Numbers.app " ) ,
115
123
FileManager . default. urls ( for: . applicationDirectory, in: . localDomainMask) . first? . appendingPathComponent ( " Pages.app " ) ,
0 commit comments