This commit is contained in:
Alin
2024-04-11 14:21:54 -06:00
parent 71a3b030d9
commit 674b55d480
5 changed files with 75 additions and 26 deletions
+4 -4
View File
@@ -575,7 +575,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 32; CURRENT_PROJECT_VERSION = 33;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BK8443AXLU; DEVELOPMENT_TEAM = BK8443AXLU;
@@ -593,7 +593,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 3.4.1; MARKETING_VERSION = 3.4.2;
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner; PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
@@ -610,7 +610,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 32; CURRENT_PROJECT_VERSION = 33;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BK8443AXLU; DEVELOPMENT_TEAM = BK8443AXLU;
@@ -628,7 +628,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 3.4.1; MARKETING_VERSION = 3.4.2;
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner; PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Pearcleaner;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
+1 -1
View File
@@ -50,7 +50,7 @@ class AppInfoFetcher {
// ?? bundle.infoDictionary?["CFBundleName"] as? String // ?? bundle.infoDictionary?["CFBundleName"] as? String
// ?? path.deletingPathExtension().lastPathComponent // ?? path.deletingPathExtension().lastPathComponent
let appName = path.deletingPathExtension().lastPathComponent.capitalized let appName = path.deletingPathExtension().lastPathComponent.capitalizingFirstLetter()
let appVersion = bundle.infoDictionary?["CFBundleShortVersionString"] as? String let appVersion = bundle.infoDictionary?["CFBundleShortVersionString"] as? String
?? bundle.infoDictionary?["CFBundleVersion"] as? String ?? bundle.infoDictionary?["CFBundleVersion"] as? String
+58 -21
View File
@@ -82,14 +82,6 @@ class AppPathFinder {
} }
} }
} }
// if FileManager.default.fileExists(atPath: itemURL.path, isDirectory: &isDirectory),
// isDirectory.boolValue,
// !shouldSkipItem(itemL, at: itemURL),
// specificCondition(itemL: itemL, itemURL: itemURL) {
// collectionAccessQueue.sync {
// self.collection.append(itemURL)
// }
// }
} }
} }
} }
@@ -114,16 +106,11 @@ class AppPathFinder {
let itemURL = URL(fileURLWithPath: location).appendingPathComponent(item) let itemURL = URL(fileURLWithPath: location).appendingPathComponent(item)
let itemL = item.replacingOccurrences(of: ".", with: "").replacingOccurrences(of: " ", with: "").lowercased() let itemL = item.replacingOccurrences(of: ".", with: "").replacingOccurrences(of: " ", with: "").lowercased()
var isDirectory: ObjCBool = false if FileManager.default.fileExists(atPath: itemURL.path),
if FileManager.default.fileExists(atPath: itemURL.path, isDirectory: &isDirectory),
!isDirectory.boolValue,
!shouldSkipItem(itemL, at: itemURL), !shouldSkipItem(itemL, at: itemURL),
specificCondition(itemL: itemL, itemURL: itemURL) { specificCondition(itemL: itemL, itemURL: itemURL) {
collectionAccessQueue.sync { collectionAccessQueue.sync {
let parentDirectory = itemURL.deletingLastPathComponent() self.collection.append(itemURL)
if !self.collection.contains(parentDirectory) {
self.collection.append(itemURL)
}
} }
} }
} }
@@ -137,7 +124,7 @@ class AppPathFinder {
collectionAccessQueue.sync { collectionAccessQueue.sync {
containsItem = self.collection.contains(itemURL) containsItem = self.collection.contains(itemURL)
} }
return itemL.hasPrefix("comapple") && !["comappleconfigurator", "comappledt", "comappleiwork"].contains(where: itemL.hasPrefix) || containsItem || !isSupportedFileType(at: itemURL.path) return itemL.hasPrefix("comapple") && !["comappleconfigurator", "comappledt", "comappleiwork", "comapplesfsymbols", "comappletestflight"].contains(where: itemL.hasPrefix) || containsItem || !isSupportedFileType(at: itemURL.path)
} }
@@ -176,8 +163,30 @@ class AppPathFinder {
} }
if bundleIdentifierL.contains("combravebrowser") { if bundleIdentifierL.contains("combravebrowser") {
// Include items for Zoom that are not similar to the app name and/or bundle id // Include items for Brave that are not similar to the app name and/or bundle id
if itemL.contains("bravesoftware") { if itemL.contains("brave") {
return true
}
}
if bundleIdentifierL.contains("comgooglechrome") {
// Include items for Chrome that are not similar to the app name and/or bundle id
if (itemL.contains("google") && !itemL.contains("iterm")) || (itemL.contains("chrome") && !itemL.contains("chromefeaturestate")) {
return true
}
}
if bundleIdentifierL.contains("commicrosoftedgemac") {
// Include items for Edge that are not similar to the app name and/or bundle id
let exclusions = ["vscode","rdc","appcenter","office","oneauth"]
if itemL.contains("microsoft") && !exclusions.contains(where: itemL.contains) {
return true
}
}
if bundleIdentifierL.contains("orgmozillafirefox") {
// Include items for Firefox that are not similar to the app name and/or bundle id
if itemL.contains("mozilla") {
return true return true
} }
} }
@@ -196,6 +205,22 @@ class AppPathFinder {
} }
} }
if bundleIdentifierL.contains("comfacebookarchondeveloperid") {
// Include items for FB Messenger
if itemL.contains("archonloginhelper") {
return true
}
}
if bundleIdentifierL.contains("euexelbanstats") {
// Include items for Stats that are not similar to the app name and/or bundle id
if itemL.contains("video") {
return false
}
}
if self.appInfo.webApp { if self.appInfo.webApp {
return itemL.contains(bundleIdentifierL) return itemL.contains(bundleIdentifierL)
} }
@@ -271,9 +296,21 @@ class AppPathFinder {
tempCollection.append(contentsOf: groupContainers) tempCollection.append(contentsOf: groupContainers)
tempCollection.append(contentsOf: outliers) tempCollection.append(contentsOf: outliers)
// Continue with the sorted collection // Sort and standardize URLs to ensure consistent comparisons
let sortedCollection = tempCollection.sorted(by: { $0.absoluteString < $1.absoluteString }) let sortedCollection = tempCollection.map { $0.standardizedFileURL }.sorted(by: { $0.path < $1.path })
self.handlePostProcessing(sortedCollection: sortedCollection) var filteredCollection: [URL] = []
var previousUrl: URL?
for url in sortedCollection {
if let previousUrl = previousUrl, url.path.hasPrefix(previousUrl.path + "/") {
// Current URL is a subdirectory of the previous one, so skip it
continue
}
// This URL is not a subdirectory of the previous one, so keep it and set it as the previous URL
filteredCollection.append(url)
previousUrl = url
}
self.handlePostProcessing(sortedCollection: filteredCollection)
} }
} }
+1
View File
@@ -34,6 +34,7 @@ class Locations: ObservableObject {
"\(home)/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments", "\(home)/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments",
"\(home)/Library/Containers", "\(home)/Library/Containers",
"\(home)/Library/Caches", "\(home)/Library/Caches",
"\(home)/Library/Group Containers",
"\(home)/Library/HTTPStorages", "\(home)/Library/HTTPStorages",
"\(home)/Library/Internet Plug-Ins", "\(home)/Library/Internet Plug-Ins",
"\(home)/Library/LaunchAgents", "\(home)/Library/LaunchAgents",
+11
View File
@@ -428,6 +428,17 @@ extension String {
} }
} }
// --- Capitalize first letter of string only
extension String {
func capitalizingFirstLetter() -> String {
return prefix(1).capitalized + dropFirst()
}
mutating func capitalizeFirstLetter() {
self = self.capitalizingFirstLetter()
}
}
// --- Trash Relationship --- // --- Trash Relationship ---
extension FileManager { extension FileManager {