Ver código fonte

avm: Add Windows support for renaming anchor binary (#3325)

Vincent 11 meses atrás
pai
commit
5fe1ae1f7d
2 arquivos alterados com 7 adições e 1 exclusões
  1. 1 0
      CHANGELOG.md
  2. 6 1
      avm/src/lib.rs

+ 1 - 0
CHANGELOG.md

@@ -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
 

+ 6 - 1
avm/src/lib.rs

@@ -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}")),
     )?;