mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-16 15:46:36 +00:00
Impl self_install
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
273a4e8f7f
commit
40a9033375
1 changed files with 7 additions and 2 deletions
|
@ -5,6 +5,7 @@ use std::{
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use atomic_file_install::atomic_install;
|
||||||
use binstalk::{
|
use binstalk::{
|
||||||
errors::{BinstallError, CrateContextError},
|
errors::{BinstallError, CrateContextError},
|
||||||
fetchers::{Fetcher, GhCrateMeta, QuickInstall, SignaturePolicy},
|
fetchers::{Fetcher, GhCrateMeta, QuickInstall, SignaturePolicy},
|
||||||
|
@ -588,7 +589,6 @@ fn do_install_fetches_continue_on_failure(
|
||||||
|
|
||||||
pub fn self_install(
|
pub fn self_install(
|
||||||
args: Args,
|
args: Args,
|
||||||
binary: &Path
|
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
// Load .cargo/config.toml
|
// Load .cargo/config.toml
|
||||||
let cargo_home = cargo_home().map_err(BinstallError::from)?;
|
let cargo_home = cargo_home().map_err(BinstallError::from)?;
|
||||||
|
@ -604,7 +604,12 @@ pub fn self_install(
|
||||||
&mut config,
|
&mut config,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// copy
|
let dest = install_path.join("cargo-binstall");
|
||||||
|
if cfg!(windows) {
|
||||||
|
assert!(dest.set_extension("exe"));
|
||||||
|
}
|
||||||
|
|
||||||
|
atomic_install(&env::current_exe()?, &dest)?;
|
||||||
|
|
||||||
if let Some(manifests) = manifests {
|
if let Some(manifests) = manifests {
|
||||||
manifests.update(vec![CrateInfo {
|
manifests.update(vec![CrateInfo {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue