mirror of git://gcc.gnu.org/git/gcc.git
backport: re PR libstdc++/71313 ([Filesystem TS] remove_all fails to remove directory contents recursively)
Backport from mainline
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.
From-SVN: r237981
This commit is contained in:
parent
021de257a6
commit
4b386db092
|
|
@ -1,3 +1,14 @@
|
||||||
|
2016-07-04 Ville Voutilainen <ville.voutilainen@gmail.com>
|
||||||
|
|
||||||
|
Backport from mainline
|
||||||
|
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-06-03 Release Manager
|
2016-06-03 Release Manager
|
||||||
|
|
||||||
* GCC 5.4.0 released.
|
* GCC 5.4.0 released.
|
||||||
|
|
|
||||||
|
|
@ -1172,7 +1172,7 @@ fs::remove_all(const path& p, error_code& ec) noexcept
|
||||||
uintmax_t count = 0;
|
uintmax_t count = 0;
|
||||||
if (ec.value() == 0 && fs.type() == file_type::directory)
|
if (ec.value() == 0 && fs.type() == file_type::directory)
|
||||||
for (directory_iterator d(p, ec), end; ec.value() == 0 && d != end; ++d)
|
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())
|
if (ec.value())
|
||||||
return -1;
|
return -1;
|
||||||
return fs::remove(p, ec) ? ++count : -1; // fs:remove() calls ec.clear()
|
return fs::remove(p, ec) ? ++count : -1; // fs:remove() calls ec.clear()
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,8 @@ test01()
|
||||||
VERIFY( b );
|
VERIFY( b );
|
||||||
VERIFY( is_directory(p/"./d4/../d5") );
|
VERIFY( is_directory(p/"./d4/../d5") );
|
||||||
|
|
||||||
remove_all(p, ec);
|
std::uintmax_t count = remove_all(p, ec);
|
||||||
|
VERIFY( count == 6 );
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue