Impl binstall_v1::default_path

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-27 18:38:26 +10:00
parent ce50186f4a
commit 951a0f8b9f
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -2,7 +2,7 @@ use std::{
fs, fs,
io::{self, Write}, io::{self, Write},
iter::IntoIterator, iter::IntoIterator,
path::Path, path::{Path, PathBuf},
}; };
use compact_str::CompactString; use compact_str::CompactString;
@ -13,7 +13,7 @@ use thiserror::Error;
use url::Url; use url::Url;
use crate::binstall::MetaData; use crate::binstall::MetaData;
use crate::FileLock; use crate::{cargo_home, FileLock};
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct Item { pub struct Item {
@ -108,3 +108,7 @@ where
Ok(()) Ok(())
} }
pub fn default_path() -> Result<PathBuf, Error> {
Ok(cargo_home()?.join(".binstall-crates.toml"))
}