From 6a529fb3cfc36bac5aebe7dae9a8fbbdcbe0fd59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Thu, 14 Sep 2023 14:34:23 -0400
Subject: [PATCH] fileutils: use std::error_code with create_directory

Change-Id: I35d67e347e0680d9867ad2764f50ec7c6c1598ca
---
 src/fileutils.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/fileutils.cpp b/src/fileutils.cpp
index 95199e3..5bd0859 100644
--- a/src/fileutils.cpp
+++ b/src/fileutils.cpp
@@ -64,11 +64,13 @@ namespace fileutils {
 bool
 check_dir(const std::filesystem::path& path, mode_t dirmode, mode_t parentmode)
 {
+    fmt::print("check_dir: {}\n", path.string());
     if (std::filesystem::exists(path))
         return true;
     if (path.has_parent_path())
         check_dir(path.parent_path(), parentmode, parentmode);
-    if (std::filesystem::create_directory(path)) {
+    std::error_code ec;
+    if (std::filesystem::create_directory(path, ec)) {
         std::filesystem::permissions(path, (std::filesystem::perms)dirmode);
         return true;
     }
-- 
GitLab