diff options
-rw-r--r-- | src/config/default.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/config/default.rs b/src/config/default.rs index 131c289..e99b255 100644 --- a/src/config/default.rs +++ b/src/config/default.rs @@ -33,8 +33,10 @@ fn get_config_path(name: &'static str) -> Result<PathBuf> { pub(super) fn create_path(path: PathBuf) -> Result<PathBuf> { if !path.exists() { - std::fs::create_dir_all(&path) - .with_context(|| format!("Failed to create the '{}' directory", path.display()))? + if let Some(parent) = path.parent() { + std::fs::create_dir_all(&parent) + .with_context(|| format!("Failed to create the '{}' directory", path.display()))? + } } Ok(path) |