diff --git a/CHANGELOG.md b/CHANGELOG.md index 269e5eb..28e5b44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added - Add support for multiple targets under the same package name in workspace members by @daimond113 +### Fixed +- Fix versions with dots not being handled correctly by @daimond113 ## [0.5.0-rc.1] - 2024-10-06 ### Changed diff --git a/src/cli/version.rs b/src/cli/version.rs index ddb2983..ca70933 100644 --- a/src/cli/version.rs +++ b/src/cli/version.rs @@ -1,10 +1,9 @@ -use std::{fs::create_dir_all, io::Read, path::PathBuf}; - use anyhow::Context; use colored::Colorize; use reqwest::header::ACCEPT; use semver::Version; use serde::Deserialize; +use std::{fs::create_dir_all, io::Read, path::PathBuf}; use crate::cli::{ bin_dir, @@ -160,9 +159,7 @@ pub fn get_or_download_version( let path = home_dir()?.join("versions"); create_dir_all(&path).context("failed to create versions directory")?; - let path = path - .join(version.to_string()) - .with_extension(std::env::consts::EXE_EXTENSION); + let path = path.join(format!("{version}{}", std::env::consts::EXE_SUFFIX)); let is_requested_version = *version == current_version(); @@ -225,9 +222,11 @@ pub fn max_installed_version() -> anyhow::Result { } pub fn update_bin_exe() -> anyhow::Result<()> { - let copy_to = bin_dir()? - .join(env!("CARGO_BIN_NAME")) - .with_extension(std::env::consts::EXE_EXTENSION); + let copy_to = bin_dir()?.join(format!( + "{}{}", + env!("CARGO_BIN_NAME"), + std::env::consts::EXE_SUFFIX + )); std::fs::copy(std::env::current_exe()?, ©_to) .context("failed to copy executable to bin folder")?;