Skip to content

Commit

Permalink
fix: use EXE_SUFFIX
Browse files Browse the repository at this point in the history
  • Loading branch information
lucab committed Sep 27, 2024
1 parent 0c9f450 commit 2708681
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion crates/uv/src/commands/tool/common.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::env::consts::EXE_SUFFIX;
use std::fmt::Write;
use std::path::Path;
use std::{collections::BTreeSet, ffi::OsString};
Expand Down Expand Up @@ -166,7 +167,7 @@ pub(crate) fn install_executables(
replace_symlink(source_path, target_path).context("Failed to install executable")?;
#[cfg(windows)]
fs_err::copy(source_path, target_path).context("Failed to install entrypoint")?;
names.insert(name.trim_end_matches(".exe"));
names.insert(name.trim_end_matches(EXE_SUFFIX));
}

let s = if names.len() == 1 { "" } else { "s" };
Expand Down
5 changes: 3 additions & 2 deletions crates/uv/src/commands/tool/uninstall.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::env::consts::EXE_SUFFIX;
use std::fmt::Write;

use anyhow::{bail, Result};
Expand Down Expand Up @@ -148,8 +149,8 @@ async fn do_uninstall(
entrypoints
};
entrypoints.sort_unstable_by(|a, b| {
let a_trimmed = a.name.trim_end_matches(".exe");
let b_trimmed = b.name.trim_end_matches(".exe");
let a_trimmed = a.name.trim_end_matches(EXE_SUFFIX);
let b_trimmed = b.name.trim_end_matches(EXE_SUFFIX);
a_trimmed.cmp(b_trimmed)
});

Expand Down

0 comments on commit 2708681

Please sign in to comment.