mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-15 15:16:37 +00:00
Copy instead of link on windows
This commit is contained in:
parent
856728b2c7
commit
48771c3061
1 changed files with 8 additions and 4 deletions
12
src/bins.rs
12
src/bins.rs
|
@ -1,4 +1,4 @@
|
||||||
use std::path::{PathBuf, Path};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use cargo_toml::Product;
|
use cargo_toml::Product;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
@ -111,16 +111,20 @@ impl BinFile {
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
std::os::unix::fs::symlink(dest, &self.link)?;
|
std::os::unix::fs::symlink(dest, &self.link)?;
|
||||||
#[cfg(target_family = "windows")]
|
#[cfg(target_family = "windows")]
|
||||||
std::os::windows::fs::symlink_file(dest, &self.link)?;
|
std::fs::copy(dest, &self.link)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link_dest(&self) -> &Path {
|
fn link_dest(&self) -> &Path {
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
{ Path::new(self.dest.file_name().unwrap()) }
|
{
|
||||||
|
Path::new(self.dest.file_name().unwrap())
|
||||||
|
}
|
||||||
#[cfg(target_family = "windows")]
|
#[cfg(target_family = "windows")]
|
||||||
{ &self.dest }
|
{
|
||||||
|
&self.dest
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue