Skip to content

Commit

Permalink
Switch binary name based on platform (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackTabsCode authored Oct 4, 2024
1 parent 5878de9 commit e7e3a8c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/biome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ impl BiomeExtension {
fs::metadata(path).map_or(false, |stat| stat.is_file())
}

fn binary_specifier(&self) -> Result<String> {
fn binary_specifier(&self) -> Result<String, String> {
let (platform, arch) = zed::current_platform();

let binary_name = match platform {
zed::Os::Windows => "biome.exe",
_ => "biome",
};

Ok(format!(
"@biomejs/cli-{platform}-{arch}/biome",
"@biomejs/cli-{platform}-{arch}/{binary}",
platform = match platform {
zed::Os::Mac => "darwin",
zed::Os::Linux => "linux",
Expand All @@ -36,6 +41,7 @@ impl BiomeExtension {
zed::Architecture::X8664 => "x64",
_ => return Err(format!("unsupported architecture: {arch:?}")),
},
binary = binary_name,
))
}

Expand Down

0 comments on commit e7e3a8c

Please sign in to comment.