fix: recursively create directories instead of failing

e.g. when ~/.config does not exist
This commit is contained in:
Henrik Friedrichsen
2019-11-24 16:39:15 +01:00
parent e697b97d8c
commit 0695434ca0
2 changed files with 3 additions and 3 deletions

View File

@@ -146,7 +146,7 @@ fn main() {
if let Some(basepath) = matches.value_of("basepath") {
let path = PathBuf::from_str(basepath).expect("invalid path");
if !path.exists() {
fs::create_dir(&path).expect("could not create basepath directory");
fs::create_dir_all(&path).expect("could not create basepath directory");
}
*config::BASE_PATH.write().unwrap() = Some(path);
}