[libcxx-commits] [PATCH] D102365: [libcxx] Fix the function name in exceptions from create_directories

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 25 13:50:32 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG68e45962531a: [libcxx] Fix the function name in exceptions from create_directories (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102365/new/

https://reviews.llvm.org/D102365

Files:
  libcxx/src/filesystem/operations.cpp
  libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp


Index: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
+++ libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
@@ -138,6 +138,18 @@
     TEST_CHECK(!exists(dir));
 }
 
+TEST_CASE(dest_is_empty_path)
+{
+    std::error_code ec = GetTestEC();
+    TEST_CHECK(fs::create_directories(fs::path{}, ec) == false);
+    TEST_CHECK(ec);
+    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    ExceptionChecker Checker(path{}, std::errc::no_such_file_or_directory,
+                             "create_directories");
+    TEST_CHECK_THROW_RESULT(filesystem_error, Checker,
+                            fs::create_directories(path{}));
+}
+
 #ifdef _WIN32
 TEST_CASE(nonexistent_root)
 {
Index: libcxx/src/filesystem/operations.cpp
===================================================================
--- libcxx/src/filesystem/operations.cpp
+++ libcxx/src/filesystem/operations.cpp
@@ -1022,7 +1022,10 @@
     } else if (not is_directory(parent_st))
       return err.report(errc::not_a_directory);
   }
-  return __create_directory(p, ec);
+  bool ret = __create_directory(p, &m_ec);
+  if (m_ec)
+    return err.report(m_ec);
+  return ret;
 }
 
 bool __create_directory(const path& p, error_code* ec) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102365.347778.patch
Type: text/x-patch
Size: 1503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210525/3ddd1139/attachment.bin>


More information about the libcxx-commits mailing list