diff --git a/Cargo.lock b/Cargo.lock index 3c882096c..4b58668cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3378,6 +3378,7 @@ dependencies = [ "reqwest-middleware", "rlimit", "rstest", + "same-file", "self-replace", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index fad683b3b..94ddffdb9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,6 +64,7 @@ reqwest-middleware = "0.3.0" reqwest-retry = "0.5.0" rlimit = "0.10.1" rstest = "0.19.0" +same-file = "1.0.6" self-replace = "1.3.7" serde = "1.0.198" serde-untagged = "0.1.5" @@ -245,6 +246,7 @@ reqwest = { workspace = true, features = [ ] } reqwest-middleware = { workspace = true } rlimit = { workspace = true } +same-file = { workspace = true } self-replace = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 77382eba3..ad09a5f0c 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -252,9 +252,9 @@ fn default_pixi_binary_path() -> std::path::PathBuf { // check current binary is in the default pixi location fn is_pixi_binary_default_location() -> bool { - let default_binary_path = default_pixi_binary_path(); - - std::env::current_exe() - .expect("Failed to retrieve the current pixi binary path") - .starts_with(default_binary_path) + same_file::is_same_file( + std::env::current_exe().expect("Failed to retrieve the current pixi binary path"), + default_pixi_binary_path(), + ) + .unwrap_or(false) }