From f496da4f3e54b761f96fc9dc8d4fc3baf0223bdb Mon Sep 17 00:00:00 2001 From: mwojcik Date: Wed, 6 Apr 2022 16:17:35 +0800 Subject: [PATCH] config: create config dir if not present --- libconfig/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libconfig/src/lib.rs b/libconfig/src/lib.rs index e5eaac0..02dd734 100644 --- a/libconfig/src/lib.rs +++ b/libconfig/src/lib.rs @@ -164,7 +164,8 @@ impl Config { f.seek(SeekFrom::End(0))?; write!(f, "{}={}\n", key, String::from_utf8(value).unwrap())?; } else { - let mut f = root_dir.create_file(&["/CONFIG/", key, ".BIN"].concat())?; + let mut dir = root_dir.create_dir("/CONFIG")?; + let mut f = dir.create_file(&[key, ".BIN"].concat())?; f.write_all(&value)?; } }