mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #123 from Arcterus/mkdir
mkdir: improve error handling (closes #121)
This commit is contained in:
commit
477065b507
1 changed files with 3 additions and 3 deletions
|
@ -126,14 +126,14 @@ fn exec(dirs: ~[~str], mk_parents: bool, mode: u32, verbose: bool) {
|
||||||
if parent_exists && !path.exists() {
|
if parent_exists && !path.exists() {
|
||||||
mkdir(&path, mode);
|
mkdir(&path, mode);
|
||||||
if verbose {println!("{}", *dir);}
|
if verbose {println!("{}", *dir);}
|
||||||
} else {
|
} else if !mk_parents {
|
||||||
let mut error_msg = ~"";
|
let mut error_msg = ~"";
|
||||||
if !parent_exists {
|
if !parent_exists {
|
||||||
error_msg.push_str("Error: parent directory '");
|
error_msg.push_str("parent directory '");
|
||||||
error_msg.push_str(parent);
|
error_msg.push_str(parent);
|
||||||
error_msg.push_str("' does not exist");
|
error_msg.push_str("' does not exist");
|
||||||
} else {
|
} else {
|
||||||
error_msg.push_str("Error: directory '");
|
error_msg.push_str("directory '");
|
||||||
error_msg.push_str(*dir);
|
error_msg.push_str(*dir);
|
||||||
error_msg.push_str("' already exists");
|
error_msg.push_str("' already exists");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue