mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Support new cmdline option --roots
(#389)
* Add new field `Args::roots` * Use `env::var_os` to fetch `CARGO_INSTALL_ROOTS` Previously, it uses `env::var`, which might reject valid path just because it is not utf-8 string. * Update manifest if `CARGO_INSTALL_ROOT` is specified * Add new fn `install_path::get_cargo_roots_path` * Fix updating manifest: Use `cargo_roots` instead of default path * Rm `helpers::statics::cargo_home` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
a611b824fd
commit
934ccc257b
7 changed files with 67 additions and 38 deletions
|
@ -1,20 +1,6 @@
|
|||
use std::{
|
||||
io::Error,
|
||||
ops::Deref,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use once_cell::sync::{Lazy, OnceCell};
|
||||
use once_cell::sync::Lazy;
|
||||
use url::Url;
|
||||
|
||||
pub fn cargo_home() -> Result<&'static Path, Error> {
|
||||
static CARGO_HOME: OnceCell<PathBuf> = OnceCell::new();
|
||||
|
||||
CARGO_HOME
|
||||
.get_or_try_init(home::cargo_home)
|
||||
.map(Deref::deref)
|
||||
}
|
||||
|
||||
pub fn cratesio_url() -> &'static Url {
|
||||
static CRATESIO: Lazy<Url, fn() -> Url> =
|
||||
Lazy::new(|| Url::parse("https://github.com/rust-lang/crates.io-index").unwrap());
|
||||
|
|
|
@ -8,3 +8,4 @@ pub mod manifests;
|
|||
pub mod ops;
|
||||
|
||||
pub use detect_targets::{get_desired_targets, DesiredTargets};
|
||||
pub use home;
|
||||
|
|
|
@ -15,11 +15,12 @@ use std::{
|
|||
};
|
||||
|
||||
use fs_lock::FileLock;
|
||||
use home::cargo_home;
|
||||
use miette::Diagnostic;
|
||||
use serde::Serialize;
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{fs::create_if_not_exist, helpers::statics::cargo_home};
|
||||
use crate::fs::create_if_not_exist;
|
||||
|
||||
use super::crate_info::CrateInfo;
|
||||
|
||||
|
|
|
@ -17,11 +17,12 @@ use std::{
|
|||
|
||||
use compact_str::CompactString;
|
||||
use fs_lock::FileLock;
|
||||
use home::cargo_home;
|
||||
use miette::Diagnostic;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{fs::create_if_not_exist, helpers::statics::cargo_home};
|
||||
use crate::fs::create_if_not_exist;
|
||||
|
||||
use super::crate_info::CrateInfo;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue