Skip to content

Commit

Permalink
refs #54, directory_entry methods now reset error_code, when returnin…
Browse files Browse the repository at this point in the history
…g cached result
  • Loading branch information
gulrak committed Mar 6, 2020
1 parent d93ccea commit 26077f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,10 @@ to the expected behavior.
### 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
handling of leading whitespace when reading `fs::path` from a stream.
* Pull request [#52](https://github.com/gulrak/filesystem/pull/52), an ARM Linux
Expand Down
5 changes: 5 additions & 0 deletions include/ghc/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
if (_status.type() != file_type::none) {
ec.clear();
return _file_size;
}
return filesystem::file_size(path(), ec);
Expand All @@ -4668,6 +4669,7 @@ GHC_INLINE uintmax_t directory_entry::hard_link_count(std::error_code& ec) const
{
#ifndef GHC_OS_WINDOWS
if (_status.type() != file_type::none) {
ec.clear();
return _hard_link_count;
}
#endif
Expand All @@ -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
{
if (_status.type() != file_type::none) {
ec.clear();
return std::chrono::system_clock::from_time_t(_last_write_time);
}
return filesystem::last_write_time(path(), ec);
Expand All @@ -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
{
if (_status.type() != file_type::none) {
ec.clear();
return _status;
}
return filesystem::status(path(), ec);
Expand All @@ -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
{
if (_symlink_status.type() != file_type::none) {
ec.clear();
return _symlink_status;
}
return filesystem::symlink_status(path(), ec);
Expand Down

0 comments on commit 26077f2

Please sign in to comment.