re PR libstdc++/71313 ([Filesystem TS] remove_all fails to remove directory contents...
authorVille Voutilainen <ville.voutilainen@gmail.com>
Mon, 4 Jul 2016 12:52:49 +0000 (15:52 +0300)
committerVille Voutilainen <ville@gcc.gnu.org>
Mon, 4 Jul 2016 12:52:49 +0000 (15:52 +0300)
PR libstdc++/71313
* src/filesystem/ops.cc (remove_all(const path&, error_code&)):
Call remove_all for children of a directory.
* testsuite/experimental/filesystem/operations/create_directories.cc:
Adjust.

From-SVN: r237978

libstdc++-v3/ChangeLog
libstdc++-v3/src/filesystem/ops.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc

index 53d040573a56332bd0c9a45096473d324259444f..92d7a4d006c820addebc454882c222825b27703e 100644 (file)
@@ -1,3 +1,11 @@
+2016-07-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR libstdc++/71313
+       * src/filesystem/ops.cc (remove_all(const path&, error_code&)):
+       Call remove_all for children of a directory.
+       * testsuite/experimental/filesystem/operations/create_directories.cc:
+       Adjust.
+
 2016-07-02  François Dumont  <fdumont@gcc.gnu.org>
 
        * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adjust
index 67ed8e6e564cbd35837cb1d4865505f2893c6251..9fb5b639fc0bd09c8c7789d6ae17e1c47b525c9e 100644 (file)
@@ -1194,7 +1194,7 @@ fs::remove_all(const path& p, error_code& ec) noexcept
   uintmax_t count = 0;
   if (ec.value() == 0 && fs.type() == file_type::directory)
     for (directory_iterator d(p, ec), end; ec.value() == 0 && d != end; ++d)
-      count += fs::remove(d->path(), ec);
+      count += fs::remove_all(d->path(), ec);
   if (ec.value())
     return -1;
   return fs::remove(p, ec) ? ++count : -1;  // fs:remove() calls ec.clear()
index 4be41a6c47ca8de85ffafe7ec15baa1ec69dfa44..a52efe4ce5ca55b924f1c787f18c03a166021518 100644 (file)
@@ -65,7 +65,8 @@ test01()
   VERIFY( b );
   VERIFY( is_directory(p/"./d4/../d5") );
 
-  remove_all(p, ec);
+  std::uintmax_t count = remove_all(p, ec);
+  VERIFY( count == 6 );
 }
 
 int