mirror of
https://github.com/exituser/Pearcleaner.git
synced 2026-09-17 08:29:07 +00:00
v2.5
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 = 15;
|
CURRENT_PROJECT_VERSION = 16;
|
||||||
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.4;
|
MARKETING_VERSION = 2.5;
|
||||||
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 = 15;
|
CURRENT_PROJECT_VERSION = 16;
|
||||||
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.4;
|
MARKETING_VERSION = 2.5;
|
||||||
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;
|
||||||
|
|||||||
@@ -73,12 +73,23 @@ func getApplications() -> (systemApps: [URL], userApps: [URL]) {
|
|||||||
func getAppInfo(atPath path: URL) -> AppInfo? {
|
func getAppInfo(atPath path: URL) -> AppInfo? {
|
||||||
if let bundle = Bundle(url: path) {
|
if let bundle = Bundle(url: path) {
|
||||||
if let bundleIdentifier = bundle.bundleIdentifier,
|
if let bundleIdentifier = bundle.bundleIdentifier,
|
||||||
let appVersion = bundle.infoDictionary?["CFBundleShortVersionString"] as? String,
|
|
||||||
var appIconFileName = bundle.infoDictionary?["CFBundleIconFile"] as? String {
|
var appIconFileName = bundle.infoDictionary?["CFBundleIconFile"] as? String {
|
||||||
|
var appVersion = "0.0.0"
|
||||||
var appIcon: NSImage?
|
var appIcon: NSImage?
|
||||||
var appName: String?
|
var appName: String?
|
||||||
var webApp: Bool?
|
var webApp: Bool?
|
||||||
|
|
||||||
|
|
||||||
|
if let shortVersion = bundle.infoDictionary?["CFBundleShortVersionString"] as? String {
|
||||||
|
appVersion = shortVersion
|
||||||
|
} else {
|
||||||
|
if let bundleVersion = bundle.infoDictionary?["CFBundleVersion"] as? String {
|
||||||
|
appVersion = bundleVersion
|
||||||
|
} else {
|
||||||
|
print("Failed to retrieve bundle version")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let localizedName = bundle.localizedInfoDictionary?[kCFBundleNameKey as String] as? String {
|
if let localizedName = bundle.localizedInfoDictionary?[kCFBundleNameKey as String] as? String {
|
||||||
appName = localizedName
|
appName = localizedName
|
||||||
} else if let bundleName = bundle.infoDictionary?["CFBundleName"] as? String {
|
} else if let bundleName = bundle.infoDictionary?["CFBundleName"] as? String {
|
||||||
@@ -125,21 +136,27 @@ func getAppInfo(atPath path: URL) -> AppInfo? {
|
|||||||
return AppInfo(id: UUID(), path: path, bundleIdentifier: bundleIdentifier, appName: appName ?? "", appVersion: appVersion, appIcon: appIcon, webApp: webApp ?? false, wrapped: false)
|
return AppInfo(id: UUID(), path: path, bundleIdentifier: bundleIdentifier, appName: appName ?? "", appVersion: appVersion, appIcon: appIcon, webApp: webApp ?? false, wrapped: false)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
let wrapperURL = path.appendingPathComponent("Wrapper")//.appendingPathComponent(path.lastPathComponent)
|
let wrapperURL = path.appendingPathComponent("Wrapper")
|
||||||
do {
|
|
||||||
let contents = try FileManager.default.contentsOfDirectory(at: wrapperURL, includingPropertiesForKeys: nil, options: [])
|
|
||||||
let appFiles = contents.filter { $0.pathExtension == "app" }
|
|
||||||
|
|
||||||
if let firstAppFile = appFiles.first {
|
// Check that file path exists, exit if not
|
||||||
let fullPath = wrapperURL.appendingPathComponent(firstAppFile.lastPathComponent)
|
if FileManager.default.fileExists(atPath: wrapperURL.path) {
|
||||||
if let wrappedAppInfo = getWrappedAppInfo(atPath: fullPath) {
|
do {
|
||||||
return wrappedAppInfo
|
let contents = try FileManager.default.contentsOfDirectory(at: wrapperURL, includingPropertiesForKeys: nil, options: [])
|
||||||
|
let appFiles = contents.filter { $0.pathExtension == "app" }
|
||||||
|
|
||||||
|
if let firstAppFile = appFiles.first {
|
||||||
|
let fullPath = wrapperURL.appendingPathComponent(firstAppFile.lastPathComponent)
|
||||||
|
if let wrappedAppInfo = getWrappedAppInfo(atPath: fullPath) {
|
||||||
|
return wrappedAppInfo
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("No .app files found in the 'Wrapper' directory.")
|
||||||
}
|
}
|
||||||
} else {
|
} catch {
|
||||||
print("No .app files found in the 'Wrapper' directory.")
|
print("Error reading contents of 'Wrapper' directory: \(error.localizedDescription)")
|
||||||
}
|
}
|
||||||
} catch {
|
} else {
|
||||||
print("Error reading contents of 'Wrapper' directory: \(error.localizedDescription)")
|
print("Error: 'Wrapper' directory not found at path: \(wrapperURL.path)")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -291,6 +308,7 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let nameL = appInfo.appName.pearFormat()
|
let nameL = appInfo.appName.pearFormat()
|
||||||
|
let nameP = appInfo.path.lastPathComponent.replacingOccurrences(of: ".app", with: "")
|
||||||
let bundleIdentifierL = appInfo.bundleIdentifier.pearFormat()
|
let bundleIdentifierL = appInfo.bundleIdentifier.pearFormat()
|
||||||
let locations = Locations()
|
let locations = Locations()
|
||||||
|
|
||||||
@@ -334,22 +352,8 @@ func findPathsForApp(appState: AppState, appInfo: AppInfo) {
|
|||||||
if itemL.contains(bundle) || itemL.contains(bundleIdentifierL) || (nameL.count > 4 && itemL.contains(nameL)) {
|
if itemL.contains(bundle) || itemL.contains(bundleIdentifierL) || (nameL.count > 4 && itemL.contains(nameL)) {
|
||||||
collection.append(itemURL)
|
collection.append(itemURL)
|
||||||
}
|
}
|
||||||
// This causes too many issues, disabling this filter for now /////////////////////////////////
|
} else {
|
||||||
// Catch Logitech files since Logi is part of word login and can return random files
|
if itemL.contains(bundleIdentifierL) || itemL.contains(bundle) || (nameL.count > 3 && itemL.contains(nameL) || (nameP.count > 3 && itemL.contains(nameP))) {
|
||||||
// } else if itemL.contains("logi") && !itemL.contains("login") {
|
|
||||||
// if itemL.contains(bundleComponents[weirdFormatBundle ? 0 : 1]) || itemL.contains(bundle) || itemL.contains(bundleIdentifierL) || (nameL.count > 3 && itemL.contains(nameL)) {
|
|
||||||
// collection.append(itemURL)
|
|
||||||
// }
|
|
||||||
// Catch MS Office files since they have many random folder names and very short names
|
|
||||||
}
|
|
||||||
// This is now covered by the group container logic, not needed anymore
|
|
||||||
// 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)) {
|
|
||||||
// collection.append(itemURL)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
else {
|
|
||||||
if itemL.contains(bundleIdentifierL) || itemL.contains(bundle) || (nameL.count > 3 && itemL.contains(nameL)) {
|
|
||||||
collection.append(itemURL)
|
collection.append(itemURL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user