mirror of
https://github.com/cobalt-org/cobalt.rs
synced 2024-11-14 16:07:22 +00:00
fix(clean): Better detect what we can't clean
This includes a more appropriate error message.
This commit is contained in:
parent
80468b9f5d
commit
78bbfc3eb3
2 changed files with 5 additions and 5 deletions
|
@ -72,14 +72,14 @@ pub fn clean_command(matches: &clap::ArgMatches) -> Result<()> {
|
|||
.dest
|
||||
.canonicalize()
|
||||
.unwrap_or_else(|_| path::PathBuf::new());
|
||||
if cwd == destdir {
|
||||
bail!("Destination directory is same as current directory. \
|
||||
if cwd.starts_with(&destdir) {
|
||||
bail!("Attempting to delete current directory, \
|
||||
Cancelling the operation");
|
||||
}
|
||||
|
||||
fs::remove_dir_all(&config.dest)?;
|
||||
fs::remove_dir_all(&destdir)?;
|
||||
|
||||
info!("directory \"{:?}\" removed", &config.dest);
|
||||
info!("directory \"{:?}\" removed", &destdir);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ pub fn clean_warning() {
|
|||
.fails_with(1)
|
||||
.stderr()
|
||||
.contains(
|
||||
"Destination directory is same as current directory. Cancelling the \
|
||||
"Attempting to delete current directory, Cancelling the \
|
||||
operation",
|
||||
)
|
||||
.unwrap();
|
||||
|
|
Loading…
Reference in a new issue