Skip to content

Commit

Permalink
avm: Add Windows support for renaming anchor binary (#3325)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentDebug authored Oct 23, 2024
1 parent 0df6884 commit 5fe1ae1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- lang: Generate documentation of constants in `declare_program!` ([#3311](https://github.com/coral-xyz/anchor/pull/3311)).
- cli: Add support for fetching legacy IDLs ([#3324](https://github.com/coral-xyz/anchor/pull/3324)).
- avm: Add short alias for `install` and `list` command ([#3326])(https://github.com/coral-xyz/anchor/pull/3326).
- avm: Add Windows support for renaming anchor binary ([#3325](https://github.com/coral-xyz/anchor/pull/3325)).

### Fixes

Expand Down
7 changes: 6 additions & 1 deletion avm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,13 @@ pub fn install_version(install_target: InstallTarget, force: bool) -> Result<()>
}

let bin_dir = get_bin_dir_path();
let bin_name = if cfg!(target_os = "windows") {
"anchor.exe"
} else {
"anchor"
};
fs::rename(
bin_dir.join("anchor"),
bin_dir.join(bin_name),
bin_dir.join(format!("anchor-{version}")),
)?;

Expand Down

0 comments on commit 5fe1ae1

Please sign in to comment.