This commit is contained in:
Alin
2024-06-26 12:39:48 -06:00
parent f6b0044bbf
commit a6dad3bb4f
4 changed files with 15 additions and 20 deletions
+4 -4
View File
@@ -576,8 +576,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
APP_BUILD = 50; APP_BUILD = 51;
APP_VERSION = 3.7.5; APP_VERSION = 3.7.6;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
@@ -646,8 +646,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
APP_BUILD = 50; APP_BUILD = 51;
APP_VERSION = 3.7.5; APP_VERSION = 3.7.6;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+3
View File
@@ -316,6 +316,8 @@ class AppPathFinder {
fileIcon[path] = getIconForFileOrFolderNS(atPath: path) fileIcon[path] = getIconForFileOrFolderNS(atPath: path)
} }
let arch = checkAppBundleArchitecture(at: self.appInfo.path.path)
DispatchQueue.main.async { DispatchQueue.main.async {
var updatedCollection = sortedCollection var updatedCollection = sortedCollection
if updatedCollection.count == 1, let firstURL = updatedCollection.first, firstURL.path.contains(".Trash") { if updatedCollection.count == 1, let firstURL = updatedCollection.first, firstURL.path.contains(".Trash") {
@@ -326,6 +328,7 @@ class AppPathFinder {
self.appInfo.fileSize = fileSize self.appInfo.fileSize = fileSize
self.appInfo.fileSizeLogical = fileSizeLogical self.appInfo.fileSizeLogical = fileSizeLogical
self.appInfo.fileIcon = fileIcon self.appInfo.fileIcon = fileIcon
self.appInfo.arch = arch
if !self.backgroundRun { if !self.backgroundRun {
self.appState.appInfo = self.appInfo self.appState.appInfo = self.appInfo
+8 -8
View File
@@ -254,7 +254,6 @@ func isRestricted(atPath path: URL) -> Bool {
// Check app bundle architecture // Check app bundle architecture
func checkAppBundleArchitecture(at appBundlePath: String) -> Arch { func checkAppBundleArchitecture(at appBundlePath: String) -> Arch {
let bundleURL = URL(fileURLWithPath: appBundlePath) let bundleURL = URL(fileURLWithPath: appBundlePath)
let executableName: String let executableName: String
@@ -264,14 +263,15 @@ func checkAppBundleArchitecture(at appBundlePath: String) -> Arch {
let bundleExecutable = infoPlist["CFBundleExecutable"] as? String { let bundleExecutable = infoPlist["CFBundleExecutable"] as? String {
executableName = bundleExecutable executableName = bundleExecutable
} else { } else {
printOS("Failed to read Info.plist or CFBundleExecutable not found when checking bundle architecture")
return .empty return .empty
} }
let executablePath = bundleURL.appendingPathComponent("Contents/MacOS/\(executableName)").path let executablePath = bundleURL.appendingPathComponent("Contents/MacOS/\(executableName)").path
let task = Process() let task = Process()
task.launchPath = "/usr/bin/lipo" task.launchPath = "/usr/bin/file"
task.arguments = ["-archs", executablePath] task.arguments = [executablePath]
let pipe = Pipe() let pipe = Pipe()
task.standardOutput = pipe task.standardOutput = pipe
@@ -281,13 +281,13 @@ func checkAppBundleArchitecture(at appBundlePath: String) -> Arch {
task.waitUntilExit() task.waitUntilExit()
if let output = String(data: data, encoding: .utf8) { if let output = String(data: data, encoding: .utf8) {
let architectures = output.trimmingCharacters(in: .whitespacesAndNewlines).components(separatedBy: " ")
if architectures.contains("x86_64") && architectures.contains("arm64") { if output.contains("Mach-O universal binary") {
return .universal return .universal
} else if architectures.contains("x86_64") { } else if output.contains("arm64") {
return .intel
} else if architectures.contains("arm64") {
return .arm return .arm
} else if output.contains("x86_64") {
return .intel
} }
} }
-8
View File
@@ -137,14 +137,6 @@ struct AppListItems: View {
appState.sortedApps[index].bundleSize = size appState.sortedApps[index].bundleSize = size
} }
} }
let architecture = checkAppBundleArchitecture(at: appInfo.path.path)
updateOnMain {
// Optionally, update the appInfo in the appState array
if let index = appState.sortedApps.firstIndex(where: { $0.path == appInfo.path }) {
appState.sortedApps[index].arch = architecture
}
}
} }
} }