Skip to content

Commit f6e0ee0

Browse files
committed
[FIX] Download server with tar.gz instead of zip
For linux and MacOS platform, releases are now in tar.gz instead of zip
1 parent 2001d4e commit f6e0ee0

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/odoo.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ impl Odoo {
3535
VERSION,
3636
)?;
3737

38-
let asset_name = format!("odoo-{}-{}.zip", Odoo::platform(), VERSION);
38+
let (platform, extension) = Odoo::platform();
39+
let asset_name = format!("odoo-{}-{}.{}", platform, VERSION, extension);
3940

4041
let asset = release.assets.iter().find(|asset| asset.name == asset_name).ok_or_else(
4142
|| format!("Odoo: No asset found for asset name {}", asset_name)
@@ -92,21 +93,21 @@ impl Odoo {
9293
Ok(binary_path)
9394
}
9495

95-
fn platform() -> &'static str {
96+
fn platform() -> (&'static str, &'static str) {
9697
let (platform, arch) = zed::current_platform();
9798
match (platform, arch) {
98-
(zed::Os::Linux, zed::Architecture::X8664) if cfg!(target_env = "musl") => "alpine-x64", // TODO it will never find musl as target_env will always be "" at compilation. Check ldd?
99-
(zed::Os::Linux, zed::Architecture::Aarch64) if cfg!(target_env = "musl") => "alpine-arm64",
100-
(zed::Os::Linux, zed::Architecture::X8664) => "linux-x64",
101-
(zed::Os::Linux, zed::Architecture::Aarch64) => "linux-arm64",
102-
(zed::Os::Windows, zed::Architecture::X8664) => "win32-x64",
103-
(zed::Os::Windows, zed::Architecture::Aarch64) => "win32-arm64",
104-
(zed::Os::Mac, zed::Architecture::X8664) => "darwin-x64",
105-
(zed::Os::Mac, zed::Architecture::Aarch64) => "darwin-arm64",
99+
(zed::Os::Linux, zed::Architecture::X8664) if cfg!(target_env = "musl") => ("alpine-x64", "tar.gz"), // TODO it will never find musl as target_env will always be "" at compilation. Check ldd?
100+
(zed::Os::Linux, zed::Architecture::Aarch64) if cfg!(target_env = "musl") => ("alpine-aarch64", "tar.gz"),
101+
(zed::Os::Linux, zed::Architecture::X8664) => ("linux-x64", "tar.gz"),
102+
(zed::Os::Linux, zed::Architecture::Aarch64) => ("linux-aarch64", "tar.gz"),
103+
(zed::Os::Windows, zed::Architecture::X8664) => ("win32-x64", "zip"),
104+
(zed::Os::Windows, zed::Architecture::Aarch64) => ("win32-aarch64", "zip"),
105+
(zed::Os::Mac, zed::Architecture::X8664) => ("darwin-x64", "tar.gz"),
106+
(zed::Os::Mac, zed::Architecture::Aarch64) => ("darwin-aarch64", "tar.gz"),
106107
(_os, arch) => {
107108
// fallback
108109
println!("Odoo: Warning: Unsupported platform {platform:?}-{arch:?}");
109-
Box::leak(format!("unknown").into_boxed_str())
110+
(Box::leak(format!("unknown").into_boxed_str()), "tar.gz")
110111
}
111112
}
112113
}

0 commit comments

Comments
 (0)