mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Direct the symlink the right way in symlink info!(), point at actual destination
This commit is contained in:
parent
5b4909f9eb
commit
f76791b9b9
1 changed files with 11 additions and 9 deletions
20
src/bins.rs
20
src/bins.rs
|
@ -1,6 +1,4 @@
|
||||||
use std::path::PathBuf;
|
use std::path::{PathBuf, Path};
|
||||||
#[cfg(target_family = "unix")]
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
use cargo_toml::Product;
|
use cargo_toml::Product;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
@ -72,8 +70,8 @@ impl BinFile {
|
||||||
format!(
|
format!(
|
||||||
"{} ({} -> {})",
|
"{} ({} -> {})",
|
||||||
self.base_name,
|
self.base_name,
|
||||||
self.dest.display(),
|
self.link.display(),
|
||||||
self.link.display()
|
self.link_dest().display()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,10 +102,7 @@ impl BinFile {
|
||||||
std::fs::remove_file(&self.link)?;
|
std::fs::remove_file(&self.link)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_family = "unix")]
|
let dest = self.link_dest();
|
||||||
let dest = &Path::new(self.dest.file_name().unwrap());
|
|
||||||
#[cfg(target_family = "windows")]
|
|
||||||
let dest = &self.dest;
|
|
||||||
debug!(
|
debug!(
|
||||||
"Create link '{}' pointing to '{}'",
|
"Create link '{}' pointing to '{}'",
|
||||||
self.link.display(),
|
self.link.display(),
|
||||||
|
@ -120,6 +115,13 @@ impl BinFile {
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn link_dest(&self) -> &Path {
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
|
{ Path::new(self.dest.file_name().unwrap()) }
|
||||||
|
#[cfg(target_family = "windows")]
|
||||||
|
{ &self.dest }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data required to get bin paths
|
/// Data required to get bin paths
|
||||||
|
|
Loading…
Add table
Reference in a new issue