From bbf22eab68558f4e9996076d82a5c5cd8cba559b Mon Sep 17 00:00:00 2001
From: d0p1 <contact@d0p1.eu>
Date: Fri, 19 Apr 2024 13:07:31 +0200
Subject: [PATCH] fix 'could not create data dir' on windows
 (clients/rust/gcli-v2s!29)

* fix 'could not create data dir' on windows

from rust doc:

If a parent of the given path doesn't exist, this function will return an error. To create a directory and all its missing parents at the same time, use the create_dir_all function.
---
 src/data.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/data.rs b/src/data.rs
index 43c8a18..d995c94 100644
--- a/src/data.rs
+++ b/src/data.rs
@@ -63,7 +63,7 @@ impl Default for Data {
 	fn default() -> Self {
 		let project_dir = directories::ProjectDirs::from("org", "duniter", "gcli").unwrap();
 		if !project_dir.data_dir().exists() {
-			std::fs::create_dir(project_dir.data_dir()).expect("could not create data dir");
+			std::fs::create_dir_all(project_dir.data_dir()).expect("could not create data dir");
 		};
 		Self {
 			project_dir,
-- 
GitLab