fileutils: use std::error_code with create_directory
Change-Id: I35d67e347e0680d9867ad2764f50ec7c6c1598ca
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 @@
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;
}