mirror of
https://github.com/exituser/Pearcleaner.git
synced 2026-09-17 06:09:01 +00:00
v2.3
This commit is contained in:
@@ -543,7 +543,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 = 13;
|
CURRENT_PROJECT_VERSION = 14;
|
||||||
DEAD_CODE_STRIPPING = YES;
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEVELOPMENT_ASSET_PATHS = "";
|
DEVELOPMENT_ASSET_PATHS = "";
|
||||||
DEVELOPMENT_TEAM = BK8443AXLU;
|
DEVELOPMENT_TEAM = BK8443AXLU;
|
||||||
@@ -561,7 +561,7 @@
|
|||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
||||||
MARKETING_VERSION = 2.2;
|
MARKETING_VERSION = 2.3;
|
||||||
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;
|
||||||
@@ -578,7 +578,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 = 13;
|
CURRENT_PROJECT_VERSION = 14;
|
||||||
DEAD_CODE_STRIPPING = YES;
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEVELOPMENT_ASSET_PATHS = "";
|
DEVELOPMENT_ASSET_PATHS = "";
|
||||||
DEVELOPMENT_TEAM = BK8443AXLU;
|
DEVELOPMENT_TEAM = BK8443AXLU;
|
||||||
@@ -596,7 +596,7 @@
|
|||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
||||||
MARKETING_VERSION = 2.2;
|
MARKETING_VERSION = 2.3;
|
||||||
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;
|
||||||
|
|||||||
@@ -35,10 +35,9 @@ struct Locations {
|
|||||||
"\(home)/Library/Application Support/CrashReporter",
|
"\(home)/Library/Application Support/CrashReporter",
|
||||||
"\(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/Group Containers",
|
// "\(home)/Library/Group Containers", // This is now handled by the function getGroupContainers()
|
||||||
"\(home)/Library/Caches",
|
"\(home)/Library/Caches",
|
||||||
"\(home)/Library/HTTPStorages",
|
"\(home)/Library/HTTPStorages",
|
||||||
"\(home)/Library/Group Containers",
|
|
||||||
"\(home)/Library/Internet Plug-Ins",
|
"\(home)/Library/Internet Plug-Ins",
|
||||||
"\(home)/Library/LaunchAgents",
|
"\(home)/Library/LaunchAgents",
|
||||||
"\(home)/Library/Logs",
|
"\(home)/Library/Logs",
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func getApplications() -> (systemApps: [URL], userApps: [URL]) {
|
|||||||
print("Error: \(error)")
|
print("Error: \(error)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect system applications
|
// Collect system applications
|
||||||
collectAppPaths(at: systemAppsPath, isSystem: true)
|
collectAppPaths(at: systemAppsPath, isSystem: true)
|
||||||
|
|
||||||
@@ -300,8 +300,9 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatchGroup.enter() // Enter the dispatch group
|
dispatchGroup.enter() // Enter the dispatch group
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
let contents = try fileManager.contentsOfDirectory(atPath: location)
|
let contents = try fileManager.contentsOfDirectory(atPath: location)
|
||||||
|
|
||||||
for item in contents {
|
for item in contents {
|
||||||
@@ -340,11 +341,14 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
|
|||||||
// collection.append(itemURL)
|
// collection.append(itemURL)
|
||||||
// }
|
// }
|
||||||
// Catch MS Office files since they have many random folder names and very short names
|
// Catch MS Office files since they have many random folder names and very short names
|
||||||
} else if itemL.contains("office") || itemL.contains("oneauth") || itemL.suffix(2).contains("ms") || itemL.contains("onenote") {
|
}
|
||||||
if itemL.contains(bundle) || itemL.contains(bundleIdentifierL) || (nameL.count > 4 && itemL.contains(nameL)) {
|
// This is now covered by the group container logic, not needed anymore
|
||||||
collection.append(itemURL)
|
// else if itemL.contains("office") || itemL.contains("oneauth") || itemL.suffix(2).contains("ms") || itemL.contains("onenote") {
|
||||||
}
|
// if itemL.contains(bundle) || itemL.contains(bundleIdentifierL) || (nameL.count > 4 && itemL.contains(nameL)) {
|
||||||
} else {
|
// collection.append(itemURL)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
else {
|
||||||
if itemL.contains(bundleIdentifierL) || itemL.contains(bundle) || (nameL.count > 3 && itemL.contains(nameL)) {
|
if itemL.contains(bundleIdentifierL) || itemL.contains(bundle) || (nameL.count > 3 && itemL.contains(nameL)) {
|
||||||
collection.append(itemURL)
|
collection.append(itemURL)
|
||||||
}
|
}
|
||||||
@@ -357,20 +361,54 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatchGroup.leave() // Leave the dispatch group
|
dispatchGroup.leave() // Leave the dispatch group
|
||||||
|
|
||||||
dispatchGroup.notify(queue: .main) {
|
|
||||||
updateOnMain {
|
|
||||||
appState.paths = collection
|
|
||||||
appState.selectedItems = Set(collection)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Append group containers
|
||||||
|
let groupContainers = getGroupContainers(bundleURL: appState.appInfo.path)
|
||||||
|
collection.append(contentsOf: groupContainers)
|
||||||
|
let sortedCollection = collection.sorted(by: { $0.absoluteString < $1.absoluteString })
|
||||||
|
|
||||||
|
// Save to appState
|
||||||
|
dispatchGroup.notify(queue: .main) {
|
||||||
|
updateOnMain {
|
||||||
|
appState.paths = sortedCollection
|
||||||
|
appState.selectedItems = Set(sortedCollection)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func getGroupContainers(bundleURL: URL) -> [URL] {
|
||||||
|
|
||||||
|
var staticCode: SecStaticCode?
|
||||||
|
|
||||||
|
guard SecStaticCodeCreateWithPath(bundleURL as CFURL, [], &staticCode) == errSecSuccess else {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
var signingInformation: CFDictionary?
|
||||||
|
|
||||||
|
let status = SecCodeCopySigningInformation(staticCode!, SecCSFlags(), &signingInformation)
|
||||||
|
|
||||||
|
if status != errSecSuccess {
|
||||||
|
print("Failed to copy signing information. Status: \(status)")
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let topDict = signingInformation as? [String: Any],
|
||||||
|
let entitlementsDict = topDict["entitlements-dict"] as? [String: Any],
|
||||||
|
let appGroups = entitlementsDict["com.apple.security.application-groups"] as? [String] else {
|
||||||
|
// print("No application groups to extract from entitlements for this app.")
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
let groupContainersPath = appGroups.map { URL(fileURLWithPath: "\(home)/Library/Group Containers/" + $0) }
|
||||||
|
|
||||||
|
return groupContainersPath
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Move files to trash using applescript/Finder so it asks for user password if needed
|
// Move files to trash using applescript/Finder so it asks for user password if needed
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ struct MiniMode: View {
|
|||||||
FilesView(showPopover: $showPopover, search: $search)
|
FilesView(showPopover: $showPopover, search: $search)
|
||||||
.id(appState.appInfo.id)
|
.id(appState.appInfo.id)
|
||||||
}
|
}
|
||||||
|
.interactiveDismissDisabled()
|
||||||
.background(
|
.background(
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.fill(Color("pop"))
|
.fill(Color("pop"))
|
||||||
|
|||||||
Reference in New Issue
Block a user