|
@@ -98,6 +98,11 @@ pub fn install_version(version: &Version) -> Result<()> {
|
|
|
&AVM_HOME.join("bin").join("anchor"),
|
|
|
&AVM_HOME.join("bin").join(format!("anchor-{}", version)),
|
|
|
)?;
|
|
|
+ // If .version file is empty or not parseable, write the newly installed version to it
|
|
|
+ if current_version().is_err() {
|
|
|
+ let mut current_version_file = fs::File::create(current_version_file_path().as_path())?;
|
|
|
+ current_version_file.write_all(version.to_string().as_bytes())?;
|
|
|
+ }
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
@@ -174,7 +179,7 @@ pub fn list_versions() -> Result<()> {
|
|
|
if installed_versions.contains(v) {
|
|
|
flags.push("installed");
|
|
|
}
|
|
|
- if current_version().unwrap() == v.clone() {
|
|
|
+ if current_version().is_ok() && current_version().unwrap() == v.clone() {
|
|
|
flags.push("current");
|
|
|
}
|
|
|
if flags.is_empty() {
|