use anyhow::{Context as _, Result};
use bezel::gpui::App;
use std::path::{Path, PathBuf};
pub(super) const SUPPORTED: bool = cfg!(target_arch = "x86_64");
pub(super) const SUFFIX: &str = "-windows-x86_64-setup.exe";
pub(super) fn remote(_: &str) -> String {
"cydonia-windows-x86_64-setup.exe".into()
}
pub(super) fn bundle(_: &App) -> Option<PathBuf> {
let exe = std::env::current_exe().ok()?;
let dir = exe.parent()?;
dir.join("unins000.exe")
.is_file()
.then(|| dir.to_path_buf())
}
pub(super) fn stage(version: &str, _: &Path) -> Result<PathBuf> {
super::download(version)
}
pub(super) fn swap_on_exit(_: &Path, setup: &Path) -> Result<()> {
std::process::Command::new(setup)
.args([
"/VERYSILENT",
"/SUPPRESSMSGBOXES",
"/NORESTART",
"/CLOSEAPPLICATIONS",
"/RELAUNCH",
])
.spawn()
.context("the installer did not start")?;
Ok(())
}