]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: Remove use of mkdir(2)
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Aug 2023 07:12:34 +0000 (09:12 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Aug 2023 07:16:07 +0000 (09:16 +0200)
src/util/wincompat.hpp
unittest/test_util_DirEntry.cpp

index e8c875d79f1751a6efad03da6ab1fa47a4c79094..3aea7ab41be864ee5fbf67755581d15b180888cd 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021-2022 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2023 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -81,7 +81,6 @@ const mode_t S_IWUSR = mode_t(_S_IWRITE);
 // clang-format on
 #  undef WIN32_NO_STATUS
 #  include <ntstatus.h>
-#  define mkdir(a, b) _mkdir(a)
 
 // Protect against incidental use of MinGW execv.
 #  define execv(a, b) do_not_call_execv_on_windows
index 044342aa8a6c273641d45179367547de5c20283b..a9426f4aeaeb78b8ae3201757d9bdb5e21b98fba 100644 (file)
@@ -22,6 +22,7 @@
 #include <util/DirEntry.hpp>
 #include <util/environment.hpp>
 #include <util/file.hpp>
+#include <util/filesystem.hpp>
 #include <util/wincompat.hpp>
 
 #include <third_party/doctest.h>
@@ -37,6 +38,8 @@
 using TestUtil::TestContext;
 using util::DirEntry;
 
+namespace fs = util::filesystem;
+
 namespace {
 
 bool
@@ -317,7 +320,7 @@ TEST_CASE("Directory")
 {
   TestContext test_context;
 
-  REQUIRE(mkdir("directory", 0456) == 0);
+  REQUIRE(fs::create_directory("directory"));
   DirEntry entry("directory");
 
   CHECK(entry);