feat: change updater to support intel macs (#262)

* feat: change updater to support intel macs

* cleanup

* Fix targeting in patch_base function
This commit is contained in:
Bryan Oltman
2025-01-24 13:58:30 -05:00
committed by GitHub
parent 71b5ed65fa
commit ba52a62b5d
+3 -2
View File
@@ -315,19 +315,20 @@ fn check_hash(path: &Path, expected_string: &str) -> anyhow::Result<()> {
impl ReadSeek for Cursor<Vec<u8>> {}
impl ReadSeek for fs::File {}
// FIXME: these patch_base functions should move to platform-specific modules where they can all be tested.
#[cfg(any(target_os = "android", test))]
fn patch_base(config: &UpdateConfig) -> anyhow::Result<Box<dyn ReadSeek>> {
let base_r = crate::android::open_base_lib(&config.libapp_path, "libapp.so")?;
Ok(Box::new(base_r))
}
#[cfg(all(target_os = "windows", not(test)))]
#[cfg(not(test))]
fn patch_base(config: &UpdateConfig) -> anyhow::Result<Box<dyn ReadSeek>> {
let file = fs::File::open(&config.libapp_path)?;
Ok(Box::new(file))
}
#[cfg(not(any(target_os = "android", target_os = "windows", test)))]
#[cfg(target_os = "ios")]
fn patch_base(config: &UpdateConfig) -> anyhow::Result<Box<dyn ReadSeek>> {
config.file_provider.open()
}