Skip to content

Commit cf1f6d7

Browse files
committed
Add app search exclusion list to settings Folders view
1 parent 883fbed commit cf1f6d7

File tree

3 files changed

+241
-77
lines changed

3 files changed

+241
-77
lines changed

Pearcleaner/Logic/AppPathsFetch.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ class AppPathFinder {
4040
// Change from lazy var to regular property initialized in init
4141
private let cachedIdentifiers: (formattedBundleId: String, bundleLastTwoComponents: String, formattedAppName: String, appNameLettersOnly: String, pathComponentName: String, useBundleIdentifier: Bool, formattedCompanyName: String?, formattedEntitlements: [String], formattedTeamIdentifier: String?)
4242

43+
// Cached exclusion list for app file search
44+
private lazy var formattedAppExclusionList: [String] = {
45+
return FolderSettingsManager.shared.fileFolderPathsApps.map { $0.pearFormat() }
46+
}()
47+
4348
// Computed property to get the effective sensitivity level
4449
private var effectiveSensitivityLevel: SearchSensitivityLevel {
4550
return overrideSensitivityLevel ?? sensitivityLevel
@@ -148,6 +153,14 @@ class AppPathFinder {
148153
var isDirectory: ObjCBool = false
149154
if FileManager.default.fileExists(atPath: scannedItemURL.path, isDirectory: &isDirectory) {
150155
if shouldSkipItem(normalizedItemName, at: scannedItemURL) { continue }
156+
157+
// Check app exclusion list
158+
let normalizedItemPath = scannedItemURL.path.pearFormat()
159+
if formattedAppExclusionList.contains(normalizedItemPath) ||
160+
formattedAppExclusionList.first(where: { normalizedItemPath.contains($0) }) != nil {
161+
continue
162+
}
163+
151164
if specificCondition(normalizedItemName: normalizedItemName, scannedItemURL: scannedItemURL) {
152165
localResults.append(scannedItemURL)
153166
}

Pearcleaner/Resources/Localizable.xcstrings

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5915,6 +5915,7 @@
59155915
}
59165916
},
59175917
"Add file/folder from clipboard" : {
5918+
"extractionState" : "stale",
59185919
"localizations" : {
59195920
"de" : {
59205921
"stringUnit" : {
@@ -6477,6 +6478,7 @@
64776478
}
64786479
},
64796480
"Add folder from clipboard" : {
6481+
"extractionState" : "stale",
64806482
"localizations" : {
64816483
"de" : {
64826484
"stringUnit" : {
@@ -9506,6 +9508,9 @@
95069508
}
95079509
}
95089510
}
9511+
},
9512+
"Application Folder" : {
9513+
95099514
},
95109515
"Application Script" : {
95119516
"extractionState" : "manual",
@@ -24004,6 +24009,12 @@
2400424009
}
2400524010
}
2400624011
}
24012+
},
24013+
"Exclude from app file search" : {
24014+
24015+
},
24016+
"Exclude from orphaned file search" : {
24017+
2400724018
},
2400824019
"Exclude system folders" : {
2400924020
"localizations" : {
@@ -24116,6 +24127,9 @@
2411624127
}
2411724128
}
2411824129
}
24130+
},
24131+
"Exclude these files and folders" : {
24132+
2411924133
},
2412024134
"Exclude these files and folders from orphaned file search" : {
2412124135
"extractionState" : "manual",
@@ -46363,6 +46377,9 @@
4636346377
}
4636446378
}
4636546379
}
46380+
},
46381+
"Path / Keyword" : {
46382+
4636646383
},
4636746384
"Path: %@" : {
4636846385
"localizations" : {
@@ -52997,6 +53014,12 @@
5299753014
}
5299853015
}
5299953016
}
53017+
},
53018+
"Remove folder" : {
53019+
53020+
},
53021+
"Remove from both lists" : {
53022+
5300053023
},
5300153024
"Remove from exclusion list" : {
5300253025
"localizations" : {

0 commit comments

Comments
 (0)