From d6d83777e6126713cebf4322820fadb4b1e72045 Mon Sep 17 00:00:00 2001 From: ahaoboy <504595380@qq.com> Date: Wed, 29 May 2024 22:02:38 +0800 Subject: [PATCH] fix: optimize out-dir display --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/command/build.rs | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index a234e19c..223f6dff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -999,6 +999,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "path-clean" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef" + [[package]] name = "pbkdf2" version = "0.11.0" @@ -1729,6 +1735,7 @@ dependencies = [ "lazy_static", "log", "parking_lot", + "path-clean", "predicates", "semver", "serde", diff --git a/Cargo.toml b/Cargo.toml index 2d78915d..3c8df396 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ toml = "0.7.3" ureq = { version = "2.6.2", features = ["json"] } walkdir = "2.3.2" which = "4.4.0" +path-clean = "1.0.1" [dev-dependencies] assert_cmd = "2.0.8" diff --git a/src/command/build.rs b/src/command/build.rs index f23394ee..9960c96c 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -16,6 +16,7 @@ use anyhow::{anyhow, bail, Error, Result}; use binary_install::Cache; use clap::Args; use log::info; +use path_clean::PathClean; use std::fmt; use std::path::PathBuf; use std::str::FromStr; @@ -217,7 +218,7 @@ impl Build { } let crate_path = get_crate_path(build_opts.path)?; let crate_data = manifest::CrateData::new(&crate_path, build_opts.out_name.clone())?; - let out_dir = crate_path.join(PathBuf::from(build_opts.out_dir)); + let out_dir = crate_path.join(PathBuf::from(build_opts.out_dir)).clean(); let dev = build_opts.dev || build_opts.debug; let profile = match (dev, build_opts.release, build_opts.profiling) {