From 834536721ce27ebfb8d73ae529d0f446725b3a4d Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 23 Aug 2024 18:15:36 +0200 Subject: fix(config/from_filesystem): Only create the parent of config paths Otherwise, it would create a `videos.sqlite` *directory*, which is obviously not ideal. --- src/config/default.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/config') 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 { pub(super) fn create_path(path: PathBuf) -> Result { 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) -- cgit 1.4.1