Skip to content

Commit

Permalink
fix: running windows installer
Browse files Browse the repository at this point in the history
  • Loading branch information
mistydemeo committed Jan 24, 2024
1 parent 0697862 commit a8a1150
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ impl AxoUpdater {
return Err(AxoupdateError::NoInstallerForPackage {});
};

let installer_path = Utf8PathBuf::try_from(tempdir.path().join("installer"))?;
let extension = if cfg!(windows) { ".ps1" } else { ".sh" };
let installer_path =
Utf8PathBuf::try_from(tempdir.path().join(format!("installer{extension}")))?;

#[cfg(unix)]
{
Expand All @@ -159,7 +161,16 @@ impl AxoUpdater {

LocalAsset::write_new_all(&download, &installer_path)?;

Cmd::new(&installer_path, "installer").run()?;
let path = if cfg!(windows) {
"powershell"
} else {
installer_path.as_str()
};
let mut command = Cmd::new(path, "installer");
if cfg!(windows) {
command.arg(&installer_path);
}
command.run()?;

Ok(true)
}
Expand Down

0 comments on commit a8a1150

Please sign in to comment.