Skip to content

Commit

Permalink
fix: Fixed the issue of installation failure with error code 255
Browse files Browse the repository at this point in the history
- Added a new feature: in Debug mode, the handling and backup status of the CC component will not be checked
- Adjusted the translation of some installation prompt messages
  • Loading branch information
X1a0He committed Jan 25, 2025
1 parent a7529b6 commit ffee995
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 28 deletions.
14 changes: 6 additions & 8 deletions Adobe Downloader.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1610;
LastUpgradeCheck = 1610;
LastUpgradeCheck = 1620;
TargetAttributes = {
3C60E16C2CE3A6CB00600C07 = {
CreatedOnToolsVersion = 16.1;
Expand Down Expand Up @@ -232,7 +232,6 @@
CODE_SIGN_ENTITLEMENTS = AdobeDownloaderHelperTool/AdobeDownloaderHelperTool.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = TG862GVKHK;
ENABLE_HARDENED_RUNTIME = NO;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
Expand Down Expand Up @@ -262,7 +261,6 @@
CODE_SIGN_ENTITLEMENTS = AdobeDownloaderHelperTool/AdobeDownloaderHelperTool.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = TG862GVKHK;
ENABLE_HARDENED_RUNTIME = NO;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
Expand Down Expand Up @@ -343,7 +341,7 @@
MACOSX_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = NO;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down Expand Up @@ -418,7 +416,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 140;
CURRENT_PROJECT_VERSION = 141;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Adobe Downloader/Preview Content\"";
DEVELOPMENT_TEAM = TG862GVKHK;
Expand All @@ -434,7 +432,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.x1a0he.macOS.Adobe-Downloader";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -452,7 +450,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 140;
CURRENT_PROJECT_VERSION = 141;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Adobe Downloader/Preview Content\"";
DEVELOPMENT_TEAM = TG862GVKHK;
Expand All @@ -468,7 +466,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.x1a0he.macOS.Adobe-Downloader";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1610"
LastUpgradeVersion = "1620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 2 additions & 0 deletions Adobe Downloader/Adobe DownloaderApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ struct Adobe_DownloaderApp: App {
if needsSetup {
showCreativeCloudAlert = true
} else if needsBackup {
#if !DEBUG
showBackupAlert = true
#endif
}

if storage.isFirstLaunch {
Expand Down
16 changes: 8 additions & 8 deletions Adobe Downloader/HelperManager/PrivilegedHelperManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ class PrivilegedHelperManager: NSObject {
}

static var getHelperStatus: Bool {
var status = false
let semaphore = DispatchSemaphore(value: 0)

shared.getHelperStatus { helperStatus in
status = helperStatus == .installed
semaphore.signal()
if let currentBuild = Bundle.main.infoDictionary?["CFBundleVersion"] as? String,
let installedBuild = UserDefaults.standard.string(forKey: "InstalledHelperBuild"),
currentBuild != installedBuild {
return false
}
semaphore.wait()
return status

let helperURL = Bundle.main.bundleURL.appendingPathComponent("Contents/Library/LaunchServices/" + machServiceName)
guard CFBundleCopyInfoDictionaryForURL(helperURL as CFURL) != nil else { return false }
return FileManager.default.fileExists(atPath: "/Library/PrivilegedHelperTools/\(machServiceName)")
}

func reinstallHelper(completion: @escaping (Bool, String) -> Void) {
Expand Down
10 changes: 5 additions & 5 deletions Adobe Downloader/Utils/ModifySetup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ class ModifySetup {

let commands = [
"""
perl -0777pi -e 'BEGIN{$/=\\1e8} s|\\x55\\x48\\x89\\xE5\\x53\\x50\\x48\\x89\\xFB\\x48\\x8B\\x05\\x70\\xC7\\x03\\x00\\x48\\x8B\\x00\\x48\\x89\\x45\\xF0\\xE8\\x24\\xD7\\xFE\\xFF\\x48\\x83\\xC3\\x08\\x48\\x39\\xD8\\x0F|\\x6A\\x01\\x58\\xC3\\x53\\x50\\x48\\x89\\xFB\\x48\\x8B\\x05\\x70\\xC7\\x03\\x00\\x48\\x8B\\x00\\x48\\x89\\x45\\xF0\\xE8\\x24\\xD7\\xFE\\xFF\\x48\\x83\\xC3\\x08\\x48\\x39\\xD8\\x0F|gs' '\(setupPath)'
perl -0777pi -e 'BEGIN{$/=\\1e8} s|\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x53\\x48\\x83\\xEC\\x48\\x48\\x89\\xFB\\x48\\x8B\\x05\\x8B\\x82\\x05\\x00\\x48\\x8B\\x00\\x48\\x89\\x45\\xD0\\x48\\x8D|\\x6A\\x01\\x58\\xC3\\x53\\x50\\x48\\x89\\xFB\\x48\\x8B\\x05\\x70\\xC7\\x03\\x00\\x48\\x8B\\x00\\x48\\x89\\x45\\xF0\\xE8\\x24\\xD7\\xFE\\xFF\\x48\\x83\\xC3\\x08\\x48\\x39\\xD8\\x0F|gs' '\(setupPath)'
""",
"""
perl -0777pi -e 'BEGIN{$/=\\1e8} s|\\xFF\\xC3\\x00\\xD1\\xF4\\x4F\\x01\\xA9\\xFD\\x7B\\x02\\xA9\\xFD\\x83\\x00\\x91\\xF3\\x03\\x00\\xAA\\x1F\\x20\\x03\\xD5\\x68\\xA1\\x1D\\x58\\x08\\x01\\x40\\xF9\\xE8\\x07\\x00\\xF9|\\x20\\x00\\x80\\xD2\\xC0\\x03\\x5F\\xD6\\xFD\\x7B\\x02\\xA9\\xFD\\x83\\x00\\x91\\xF3\\x03\\x00\\xAA\\x1F\\x20\\x03\\xD5\\x68\\xA1\\x1D\\x58\\x08\\x01\\x40\\xF9\\xE8\\x07\\x00\\xF9|gs' '\(setupPath)'
perl -0777pi -e 'BEGIN{$/=\\1e8} s|\\xFF\\x43\\x02\\xD1\\xFA\\x67\\x04\\xA9\\xF8\\x5F\\x05\\xA9\\xF6\\x57\\x06\\xA9\\xF4\\x4F\\x07\\xA9\\xFD\\x7B\\x08\\xA9\\xFD\\x03\\x02\\x91\\xF3\\x03\\x00\\xAA\\x1F\\x20\\x03\\xD5|\\x20\\x00\\x80\\xD2\\xC0\\x03\\x5F\\xD6\\xFD\\x7B\\x02\\xA9\\xFD\\x83\\x00\\x91\\xF3\\x03\\x00\\xAA\\x1F\\x20\\x03\\xD5\\x68\\xA1\\x1D\\x58\\x08\\x01\\x40\\xF9\\xE8\\x07\\x00\\xF9|gs' '\(setupPath)'
""",
"codesign --remove-signature '\(setupPath)'",
"codesign -f -s - --timestamp=none --all-architectures --deep '\(setupPath)'",
Expand Down Expand Up @@ -189,9 +189,9 @@ class ModifySetup {

guard FileManager.default.fileExists(atPath: setupPath) else { return false }

let intelPattern = Data([0x55, 0x48, 0x89, 0xE5, 0x53, 0x50, 0x48, 0x89, 0xFB, 0x48, 0x8B, 0x05, 0x70, 0xC7, 0x03, 0x00, 0x48, 0x8B, 0x00, 0x48, 0x89, 0x45, 0xF0, 0xE8, 0x24, 0xD7, 0xFE, 0xFF, 0x48, 0x83, 0xC3, 0x08, 0x48, 0x39, 0xD8, 0x0F])
let armPattern = Data([0xFF, 0xC3, 0x00, 0xD1, 0xF4, 0x4F, 0x01, 0xA9, 0xFD, 0x7B, 0x02, 0xA9, 0xFD, 0x83, 0x00, 0x91, 0xF3, 0x03, 0x00, 0xAA, 0x1F, 0x20, 0x03, 0xD5, 0x68, 0xA1, 0x1D, 0x58, 0x08, 0x01, 0x40, 0xF9, 0xE8, 0x07, 0x00, 0xF9])
let intelPattern = Data([0x55, 0x48, 0x89, 0xE5, 0x41, 0x57, 0x41, 0x56, 0x41, 0x55, 0x41, 0x54, 0x53, 0x48, 0x83, 0xEC, 0x48, 0x48, 0x89, 0xFB, 0x48, 0x8B, 0x05, 0x8B, 0x82, 0x05, 0x00, 0x48, 0x8B, 0x00, 0x48, 0x89, 0x45, 0xD0, 0x48, 0x8D])

let armPattern = Data([0xFF, 0x43, 0x02, 0xD1, 0xFA, 0x67, 0x04, 0xA9, 0xF8, 0x5F, 0x05, 0xA9, 0xF6, 0x57, 0x06, 0xA9, 0xF4, 0x4F, 0x07, 0xA9, 0xFD, 0x7B, 0x08, 0xA9, 0xFD, 0x03, 0x02, 0x91, 0xF3, 0x03, 0x00, 0xAA, 0x1F, 0x20, 0x03, 0xD5])

do {
let fileData = try Data(contentsOf: URL(fileURLWithPath: setupPath))
Expand Down
18 changes: 17 additions & 1 deletion Adobe Downloader/Views/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,11 @@ struct SetupComponentRow: View {
VStack(alignment: .leading, spacing: 8) {
HStack {
Text("X1a0He CC 备份状态: ")
#if DEBUG
Image(systemName: "ladybug.fill")
.foregroundColor(.yellow)
Text("Debug 模式")
#else
if ModifySetup.isSetupBackup() {
Image(systemName: "checkmark.circle.fill")
.foregroundColor(.green)
Expand All @@ -765,10 +770,16 @@ struct SetupComponentRow: View {
.foregroundColor(.red)
Text("(可能导致处理 Setup 组件失败)")
}
#endif
}
Divider()
HStack {
Text("X1a0He CC 处理状态: ")
#if DEBUG
Image(systemName: "ladybug.fill")
.foregroundColor(.yellow)
Text("Debug 模式")
#else
if ModifySetup.isSetupModified() {
Image(systemName: "checkmark.circle.fill")
.foregroundColor(.green)
Expand All @@ -778,6 +789,7 @@ struct SetupComponentRow: View {
.foregroundColor(.red)
Text("(将导致无法使用安装功能)")
}
#endif
Spacer()

Button(action: {
Expand All @@ -792,7 +804,11 @@ struct SetupComponentRow: View {
}
Divider()
HStack {
Text("X1a0He CC 版本信息: \(viewModel.setupVersion) [\(AppStatics.cpuArchitecture)]")
Text("X1a0He CC 版本信息: ")
Image(systemName: "info.circle.fill")
.foregroundColor(.blue)
Text("\(viewModel.setupVersion)")
Text(" [\(AppStatics.cpuArchitecture)]")
Spacer()

if viewModel.isDownloadingSetup {
Expand Down
6 changes: 3 additions & 3 deletions Adobe Downloader/Views/DownloadProgressView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ struct DownloadProgressView: View {
InstallProgressView(
productName: task.displayName,
progress: 1.0,
status: "安装完成",
status: String(localized: "安装完成"),
onCancel: {
isInstalling = false
},
Expand All @@ -218,7 +218,7 @@ struct DownloadProgressView: View {
InstallProgressView(
productName: task.displayName,
progress: 0,
status: "安装失败: \(error.localizedDescription)",
status: String(localized: "安装失败: \(error.localizedDescription)"),
onCancel: {
isInstalling = false
},
Expand All @@ -232,7 +232,7 @@ struct DownloadProgressView: View {
InstallProgressView(
productName: task.displayName,
progress: 0,
status: "准备安装...",
status: String(localized: "准备安装..."),
onCancel: {
networkManager.cancelInstallation()
isInstalling = false
Expand Down
28 changes: 26 additions & 2 deletions Localizables/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"strings" : {
"" : {

},
" [%@]" : {

},
"(可能导致处理 Setup 组件失败)" : {
"localizations" : {
Expand Down Expand Up @@ -175,6 +178,17 @@
},
"By X1a0He. ❤️ Love from China. 🇨🇳" : {

},
"Debug 模式" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Debug Mode"
}
}
}
},
"GNU通用公共许可证GPL v3." : {
"localizations" : {
Expand Down Expand Up @@ -349,12 +363,12 @@
}
}
},
"X1a0He CC 版本信息: %@ [%@]" : {
"X1a0He CC 版本信息: " : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "X1a0He CC version info: %1$@ [%2$@]"
"value" : "X1a0He CC version info: "
}
}
}
Expand Down Expand Up @@ -666,6 +680,16 @@
}
}
},
"准备安装..." : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ready to Install…"
}
}
}
},
"删除" : {
"localizations" : {
"en" : {
Expand Down

0 comments on commit ffee995

Please sign in to comment.