Make a directory
(current_directory: &Path, args: &[&str])
| 137 | |
| 138 | /// Make a directory |
| 139 | fn mkdir(current_directory: &Path, args: &[&str]) { |
| 140 | if args.len() != 1 { |
| 141 | println!("Usage: mkdir <directory>"); |
| 142 | return; |
| 143 | } |
| 144 | let arg = args.first().unwrap(); |
| 145 | let path = fs::canonicalize(PathBuf::from(current_directory).join(arg)).unwrap(); |
| 146 | if let Err(err) = fs::create_dir(path) { |
| 147 | // Failed |
| 148 | println!("mkdir: cannot create {}: {:?}", arg, err); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | #[no_mangle] |
| 153 | fn main() { |
no test coverage detected