mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-07-24 03:54:26 +08:00
refs #54, directory_entry methods now reset error_code, when returning cached result
This commit is contained in:
parent
d93ccea812
commit
26077f272e
@ -486,6 +486,10 @@ to the expected behavior.
|
|||||||
|
|
||||||
### v1.3.1 (wip)
|
### v1.3.1 (wip)
|
||||||
|
|
||||||
|
* Bugfix for [#55](https://github.com/gulrak/filesystem/issues/55), `fs::create_directories`
|
||||||
|
returned `true` when nothing needed to be created, because the directory already existed.
|
||||||
|
* Bugfix for [#54](https://github.com/gulrak/filesystem/issues/54), `error_code`
|
||||||
|
was not reset, if cached result was returned.
|
||||||
* Pull request [#53](https://github.com/gulrak/filesystem/pull/53), fix for wrong
|
* Pull request [#53](https://github.com/gulrak/filesystem/pull/53), fix for wrong
|
||||||
handling of leading whitespace when reading `fs::path` from a stream.
|
handling of leading whitespace when reading `fs::path` from a stream.
|
||||||
* Pull request [#52](https://github.com/gulrak/filesystem/pull/52), an ARM Linux
|
* Pull request [#52](https://github.com/gulrak/filesystem/pull/52), an ARM Linux
|
||||||
|
@ -4649,6 +4649,7 @@ GHC_INLINE uintmax_t directory_entry::file_size() const
|
|||||||
GHC_INLINE uintmax_t directory_entry::file_size(std::error_code& ec) const noexcept
|
GHC_INLINE uintmax_t directory_entry::file_size(std::error_code& ec) const noexcept
|
||||||
{
|
{
|
||||||
if (_status.type() != file_type::none) {
|
if (_status.type() != file_type::none) {
|
||||||
|
ec.clear();
|
||||||
return _file_size;
|
return _file_size;
|
||||||
}
|
}
|
||||||
return filesystem::file_size(path(), ec);
|
return filesystem::file_size(path(), ec);
|
||||||
@ -4668,6 +4669,7 @@ GHC_INLINE uintmax_t directory_entry::hard_link_count(std::error_code& ec) const
|
|||||||
{
|
{
|
||||||
#ifndef GHC_OS_WINDOWS
|
#ifndef GHC_OS_WINDOWS
|
||||||
if (_status.type() != file_type::none) {
|
if (_status.type() != file_type::none) {
|
||||||
|
ec.clear();
|
||||||
return _hard_link_count;
|
return _hard_link_count;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -4685,6 +4687,7 @@ GHC_INLINE file_time_type directory_entry::last_write_time() const
|
|||||||
GHC_INLINE file_time_type directory_entry::last_write_time(std::error_code& ec) const noexcept
|
GHC_INLINE file_time_type directory_entry::last_write_time(std::error_code& ec) const noexcept
|
||||||
{
|
{
|
||||||
if (_status.type() != file_type::none) {
|
if (_status.type() != file_type::none) {
|
||||||
|
ec.clear();
|
||||||
return std::chrono::system_clock::from_time_t(_last_write_time);
|
return std::chrono::system_clock::from_time_t(_last_write_time);
|
||||||
}
|
}
|
||||||
return filesystem::last_write_time(path(), ec);
|
return filesystem::last_write_time(path(), ec);
|
||||||
@ -4701,6 +4704,7 @@ GHC_INLINE file_status directory_entry::status() const
|
|||||||
GHC_INLINE file_status directory_entry::status(std::error_code& ec) const noexcept
|
GHC_INLINE file_status directory_entry::status(std::error_code& ec) const noexcept
|
||||||
{
|
{
|
||||||
if (_status.type() != file_type::none) {
|
if (_status.type() != file_type::none) {
|
||||||
|
ec.clear();
|
||||||
return _status;
|
return _status;
|
||||||
}
|
}
|
||||||
return filesystem::status(path(), ec);
|
return filesystem::status(path(), ec);
|
||||||
@ -4717,6 +4721,7 @@ GHC_INLINE file_status directory_entry::symlink_status() const
|
|||||||
GHC_INLINE file_status directory_entry::symlink_status(std::error_code& ec) const noexcept
|
GHC_INLINE file_status directory_entry::symlink_status(std::error_code& ec) const noexcept
|
||||||
{
|
{
|
||||||
if (_symlink_status.type() != file_type::none) {
|
if (_symlink_status.type() != file_type::none) {
|
||||||
|
ec.clear();
|
||||||
return _symlink_status;
|
return _symlink_status;
|
||||||
}
|
}
|
||||||
return filesystem::symlink_status(path(), ec);
|
return filesystem::symlink_status(path(), ec);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user