mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-04 11:42:28 +00:00
Release Cosmopolitan v3.6.0
This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
287
third_party/libcxx/__filesystem/directory_entry.h
vendored
287
third_party/libcxx/__filesystem/directory_entry.h
vendored
|
@ -10,7 +10,6 @@
|
|||
#ifndef _LIBCPP___FILESYSTEM_DIRECTORY_ENTRY_H
|
||||
#define _LIBCPP___FILESYSTEM_DIRECTORY_ENTRY_H
|
||||
|
||||
#include <__availability>
|
||||
#include <__chrono/time_point.h>
|
||||
#include <__compare/ordering.h>
|
||||
#include <__config>
|
||||
|
@ -26,7 +25,6 @@
|
|||
#include <__utility/move.h>
|
||||
#include <__utility/unreachable.h>
|
||||
#include <cstdint>
|
||||
#include <iosfwd>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
|
@ -35,231 +33,160 @@
|
|||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
|
||||
|
||||
class directory_entry {
|
||||
typedef _VSTD_FS::path _Path;
|
||||
typedef filesystem::path _Path;
|
||||
|
||||
public:
|
||||
// constructors and destructors
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry() noexcept = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry() noexcept = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry&&) noexcept = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit directory_entry(_Path const& __p) : __p_(__p) {
|
||||
_LIBCPP_HIDE_FROM_ABI explicit directory_entry(_Path const& __p) : __p_(__p) {
|
||||
error_code __ec;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) {
|
||||
__refresh(&__ec);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) { __refresh(&__ec); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI ~directory_entry() {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry const&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry&&) noexcept = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(_Path const& __p) {
|
||||
_LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p) {
|
||||
__p_ = __p;
|
||||
error_code __ec;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(_Path const& __p, error_code& __ec) {
|
||||
_LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p, error_code& __ec) {
|
||||
__p_ = __p;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void replace_filename(_Path const& __p) {
|
||||
_LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p) {
|
||||
__p_.replace_filename(__p);
|
||||
error_code __ec;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void replace_filename(_Path const& __p, error_code& __ec) {
|
||||
_LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p, error_code& __ec) {
|
||||
__p_ = __p_.parent_path() / __p;
|
||||
__refresh(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void refresh() { __refresh(); }
|
||||
_LIBCPP_HIDE_FROM_ABI void refresh() { __refresh(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
|
||||
_LIBCPP_HIDE_FROM_ABI void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Path const& path() const noexcept { return __p_; }
|
||||
_LIBCPP_HIDE_FROM_ABI _Path const& path() const noexcept { return __p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
operator const _Path&() const noexcept { return __p_; }
|
||||
_LIBCPP_HIDE_FROM_ABI operator const _Path&() const noexcept { return __p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool exists() const { return _VSTD_FS::exists(file_status{__get_ft()}); }
|
||||
_LIBCPP_HIDE_FROM_ABI bool exists() const { return filesystem::exists(file_status{__get_ft()}); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool exists(error_code& __ec) const noexcept {
|
||||
return _VSTD_FS::exists(file_status{__get_ft(&__ec)});
|
||||
_LIBCPP_HIDE_FROM_ABI bool exists(error_code& __ec) const noexcept {
|
||||
return filesystem::exists(file_status{__get_ft(&__ec)});
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_block_file() const { return __get_ft() == file_type::block; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_block_file() const { return __get_ft() == file_type::block; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_block_file(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_block_file(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::block;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_character_file() const { return __get_ft() == file_type::character; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_character_file() const { return __get_ft() == file_type::character; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_character_file(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_character_file(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::character;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_directory() const { return __get_ft() == file_type::directory; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_directory() const { return __get_ft() == file_type::directory; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_directory(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_directory(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::directory;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_fifo() const { return __get_ft() == file_type::fifo; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_fifo() const { return __get_ft() == file_type::fifo; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_fifo(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::fifo;
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_fifo(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::fifo; }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_other() const { return filesystem::is_other(file_status{__get_ft()}); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_other(error_code& __ec) const noexcept {
|
||||
return filesystem::is_other(file_status{__get_ft(&__ec)});
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_other() const { return _VSTD_FS::is_other(file_status{__get_ft()}); }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_regular_file() const { return __get_ft() == file_type::regular; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_other(error_code& __ec) const noexcept {
|
||||
return _VSTD_FS::is_other(file_status{__get_ft(&__ec)});
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_regular_file() const { return __get_ft() == file_type::regular; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_regular_file(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_regular_file(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::regular;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_socket() const { return __get_ft() == file_type::socket; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_socket() const { return __get_ft() == file_type::socket; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_socket(error_code& __ec) const noexcept {
|
||||
return __get_ft(&__ec) == file_type::socket;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_socket(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::socket; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_symlink(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI bool is_symlink(error_code& __ec) const noexcept {
|
||||
return __get_sym_ft(&__ec) == file_type::symlink;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t file_size() const { return __get_size(); }
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t file_size() const { return __get_size(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t file_size(error_code& __ec) const noexcept {
|
||||
return __get_size(&__ec);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t file_size(error_code& __ec) const noexcept { return __get_size(&__ec); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t hard_link_count() const { return __get_nlink(); }
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count() const { return __get_nlink(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t hard_link_count(error_code& __ec) const noexcept {
|
||||
return __get_nlink(&__ec);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(error_code& __ec) const noexcept { return __get_nlink(&__ec); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_time_type last_write_time() const { return __get_write_time(); }
|
||||
_LIBCPP_HIDE_FROM_ABI file_time_type last_write_time() const { return __get_write_time(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_time_type last_write_time(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(error_code& __ec) const noexcept {
|
||||
return __get_write_time(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status status() const { return __get_status(); }
|
||||
_LIBCPP_HIDE_FROM_ABI file_status status() const { return __get_status(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status status(error_code& __ec) const noexcept {
|
||||
return __get_status(&__ec);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI file_status status(error_code& __ec) const noexcept { return __get_status(&__ec); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status symlink_status() const { return __get_symlink_status(); }
|
||||
_LIBCPP_HIDE_FROM_ABI file_status symlink_status() const { return __get_symlink_status(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status symlink_status(error_code& __ec) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI file_status symlink_status(error_code& __ec) const noexcept {
|
||||
return __get_symlink_status(&__ec);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator==(directory_entry const& __rhs) const noexcept { return __p_ == __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ == __rhs.__p_;
|
||||
}
|
||||
# if _LIBCPP_STD_VER <= 17
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator!=(directory_entry const& __rhs) const noexcept { return __p_ != __rhs.__p_; }
|
||||
|
||||
#if _LIBCPP_STD_VER <= 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ != __rhs.__p_;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator<(directory_entry const& __rhs) const noexcept { return __p_ < __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ < __rhs.__p_;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator<=(directory_entry const& __rhs) const noexcept { return __p_ <= __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ <= __rhs.__p_;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator>(directory_entry const& __rhs) const noexcept { return __p_ > __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ > __rhs.__p_;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI bool operator>=(directory_entry const& __rhs) const noexcept { return __p_ >= __rhs.__p_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(directory_entry const& __rhs) const noexcept {
|
||||
return __p_ >= __rhs.__p_;
|
||||
}
|
||||
# else // _LIBCPP_STD_VER <= 17
|
||||
|
||||
#else // _LIBCPP_STD_VER <= 17
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
strong_ordering operator<=>(const directory_entry& __rhs) const noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const directory_entry& __rhs) const noexcept {
|
||||
return __p_ <=> __rhs.__p_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER <= 17
|
||||
# endif // _LIBCPP_STD_VER <= 17
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) {
|
||||
_LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) {
|
||||
return __os << __d.path();
|
||||
}
|
||||
|
||||
|
@ -286,23 +213,20 @@ private:
|
|||
file_type __type_;
|
||||
_CacheType __cache_type_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__cached_data() noexcept { __reset(); }
|
||||
_LIBCPP_HIDE_FROM_ABI __cached_data() noexcept { __reset(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __reset() {
|
||||
_LIBCPP_HIDE_FROM_ABI void __reset() {
|
||||
__cache_type_ = _Empty;
|
||||
__type_ = file_type::none;
|
||||
__type_ = file_type::none;
|
||||
__sym_perms_ = __non_sym_perms_ = perms::unknown;
|
||||
__size_ = __nlink_ = uintmax_t(-1);
|
||||
__write_time_ = file_time_type::min();
|
||||
__write_time_ = file_time_type::min();
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __cached_data __create_iter_result(file_type __ft) {
|
||||
_LIBCPP_HIDE_FROM_ABI static __cached_data __create_iter_result(file_type __ft) {
|
||||
__cached_data __data;
|
||||
__data.__type_ = __ft;
|
||||
__data.__type_ = __ft;
|
||||
__data.__cache_type_ = [&]() {
|
||||
switch (__ft) {
|
||||
case file_type::none:
|
||||
|
@ -316,17 +240,14 @@ private:
|
|||
return __data;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
|
||||
__p_ = _VSTD::move(__p);
|
||||
_LIBCPP_HIDE_FROM_ABI void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
|
||||
__p_ = std::move(__p);
|
||||
__data_ = __dt;
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
error_code __do_refresh() noexcept;
|
||||
_LIBCPP_EXPORTED_FROM_ABI error_code __do_refresh() noexcept;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __is_dne_error(error_code const& __ec) {
|
||||
_LIBCPP_HIDE_FROM_ABI static bool __is_dne_error(error_code const& __ec) {
|
||||
if (!__ec)
|
||||
return true;
|
||||
switch (static_cast<errc>(__ec.value())) {
|
||||
|
@ -338,9 +259,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __handle_error(const char* __msg, error_code* __dest_ec,
|
||||
error_code const& __ec, bool __allow_dne = false) const {
|
||||
_LIBCPP_HIDE_FROM_ABI void
|
||||
__handle_error(const char* __msg, error_code* __dest_ec, error_code const& __ec, bool __allow_dne = false) const {
|
||||
if (__dest_ec) {
|
||||
*__dest_ec = __ec;
|
||||
return;
|
||||
|
@ -349,14 +269,14 @@ private:
|
|||
__throw_filesystem_error(__msg, __p_, __ec);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __refresh(error_code* __ec = nullptr) {
|
||||
__handle_error("in directory_entry::refresh", __ec, __do_refresh(),
|
||||
_LIBCPP_HIDE_FROM_ABI void __refresh(error_code* __ec = nullptr) {
|
||||
__handle_error("in directory_entry::refresh",
|
||||
__ec,
|
||||
__do_refresh(),
|
||||
/*allow_dne*/ true);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_type __get_sym_ft(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_type __get_sym_ft(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
return __symlink_status(__p_, __ec).type();
|
||||
|
@ -369,7 +289,7 @@ private:
|
|||
case _IterNonSymlink:
|
||||
case _RefreshNonSymlink:
|
||||
file_status __st(__data_.__type_);
|
||||
if (__ec && !_VSTD_FS::exists(__st))
|
||||
if (__ec && !filesystem::exists(__st))
|
||||
*__ec = make_error_code(errc::no_such_file_or_directory);
|
||||
else if (__ec)
|
||||
__ec->clear();
|
||||
|
@ -378,8 +298,7 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_type __get_ft(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_type __get_ft(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterSymlink:
|
||||
|
@ -389,7 +308,7 @@ private:
|
|||
case _RefreshNonSymlink:
|
||||
case _RefreshSymlink: {
|
||||
file_status __st(__data_.__type_);
|
||||
if (__ec && !_VSTD_FS::exists(__st))
|
||||
if (__ec && !filesystem::exists(__st))
|
||||
*__ec = make_error_code(errc::no_such_file_or_directory);
|
||||
else if (__ec)
|
||||
__ec->clear();
|
||||
|
@ -399,8 +318,7 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status __get_status(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_status __get_status(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
|
@ -414,8 +332,7 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_status __get_symlink_status(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_status __get_symlink_status(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
|
@ -430,24 +347,21 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t __get_size(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t __get_size(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
case _IterSymlink:
|
||||
case _RefreshSymlinkUnresolved:
|
||||
return _VSTD_FS::__file_size(__p_, __ec);
|
||||
return filesystem::__file_size(__p_, __ec);
|
||||
case _RefreshSymlink:
|
||||
case _RefreshNonSymlink: {
|
||||
error_code __m_ec;
|
||||
file_status __st(__get_ft(&__m_ec));
|
||||
__handle_error("in directory_entry::file_size", __ec, __m_ec);
|
||||
if (_VSTD_FS::exists(__st) && !_VSTD_FS::is_regular_file(__st)) {
|
||||
errc __err_kind = _VSTD_FS::is_directory(__st) ? errc::is_a_directory
|
||||
: errc::not_supported;
|
||||
__handle_error("in directory_entry::file_size", __ec,
|
||||
make_error_code(__err_kind));
|
||||
if (filesystem::exists(__st) && !filesystem::is_regular_file(__st)) {
|
||||
errc __err_kind = filesystem::is_directory(__st) ? errc::is_a_directory : errc::not_supported;
|
||||
__handle_error("in directory_entry::file_size", __ec, make_error_code(__err_kind));
|
||||
}
|
||||
return __data_.__size_;
|
||||
}
|
||||
|
@ -455,14 +369,13 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
uintmax_t __get_nlink(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI uintmax_t __get_nlink(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
case _IterSymlink:
|
||||
case _RefreshSymlinkUnresolved:
|
||||
return _VSTD_FS::__hard_link_count(__p_, __ec);
|
||||
return filesystem::__hard_link_count(__p_, __ec);
|
||||
case _RefreshSymlink:
|
||||
case _RefreshNonSymlink: {
|
||||
error_code __m_ec;
|
||||
|
@ -474,23 +387,20 @@ private:
|
|||
__libcpp_unreachable();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
file_time_type __get_write_time(error_code* __ec = nullptr) const {
|
||||
_LIBCPP_HIDE_FROM_ABI file_time_type __get_write_time(error_code* __ec = nullptr) const {
|
||||
switch (__data_.__cache_type_) {
|
||||
case _Empty:
|
||||
case _IterNonSymlink:
|
||||
case _IterSymlink:
|
||||
case _RefreshSymlinkUnresolved:
|
||||
return _VSTD_FS::__last_write_time(__p_, __ec);
|
||||
return filesystem::__last_write_time(__p_, __ec);
|
||||
case _RefreshSymlink:
|
||||
case _RefreshNonSymlink: {
|
||||
error_code __m_ec;
|
||||
file_status __st(__get_ft(&__m_ec));
|
||||
__handle_error("in directory_entry::last_write_time", __ec, __m_ec);
|
||||
if (_VSTD_FS::exists(__st) &&
|
||||
__data_.__write_time_ == file_time_type::min())
|
||||
__handle_error("in directory_entry::last_write_time", __ec,
|
||||
make_error_code(errc::value_too_large));
|
||||
if (filesystem::exists(__st) && __data_.__write_time_ == file_time_type::min())
|
||||
__handle_error("in directory_entry::last_write_time", __ec, make_error_code(errc::value_too_large));
|
||||
return __data_.__write_time_;
|
||||
}
|
||||
}
|
||||
|
@ -504,24 +414,21 @@ private:
|
|||
|
||||
class __dir_element_proxy {
|
||||
public:
|
||||
inline _LIBCPP_INLINE_VISIBILITY directory_entry operator*() {
|
||||
return _VSTD::move(__elem_);
|
||||
}
|
||||
inline _LIBCPP_HIDE_FROM_ABI directory_entry operator*() { return std::move(__elem_); }
|
||||
|
||||
private:
|
||||
friend class directory_iterator;
|
||||
friend class recursive_directory_iterator;
|
||||
_LIBCPP_HIDE_FROM_ABI explicit __dir_element_proxy(directory_entry const& __e) : __elem_(__e) {}
|
||||
_LIBCPP_HIDE_FROM_ABI __dir_element_proxy(__dir_element_proxy&& __o)
|
||||
: __elem_(_VSTD::move(__o.__elem_)) {}
|
||||
_LIBCPP_HIDE_FROM_ABI __dir_element_proxy(__dir_element_proxy&& __o) : __elem_(std::move(__o.__elem_)) {}
|
||||
directory_entry __elem_;
|
||||
};
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue