fs::create_dir_all(&install_path) in main.rs

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-08-04 13:59:50 +10:00
parent 346bb8ee67
commit 28aeae938e
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -1,5 +1,6 @@
use std::{
ffi::OsString,
fs,
mem::take,
path::{Path, PathBuf},
process::{ExitCode, Termination},
@ -295,6 +296,7 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
error!("No viable install path found of specified, try `--install-path`");
miette!("No install path found or specified")
})?;
fs::create_dir_all(&install_path).map_err(BinstallError::Io)?;
debug!("Using install path: {}", install_path.display());
// Create a temporary directory for downloads etc.
@ -393,6 +395,10 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
block_in_place(|| {
if !custom_install_path {
// If using standardised install path,
// then create_dir_all(&install_path) would also
// create .cargo.
debug!("Writing .crates.toml");
metafiles::v1::CratesToml::append(metadata_vec.iter())?;