mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
File: Add misc useful API from C++17.
This commit is contained in:
parent
b9e475cbf4
commit
86f672af2b
@ -251,6 +251,10 @@ path& path::replace_extension(const path& replacement) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator<(const path& lhs, const path& rhs) {
|
||||
return lhs.native() < rhs.native();
|
||||
}
|
||||
|
||||
bool operator>(const path& lhs, const path& rhs) {
|
||||
return lhs.native() > rhs.native();
|
||||
}
|
||||
@ -276,6 +280,10 @@ directory_iterator& directory_iterator::operator++() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool is_directory(const file_status s) {
|
||||
return (s & AM_DIR);
|
||||
}
|
||||
|
||||
bool is_regular_file(const file_status s) {
|
||||
return !(s & AM_DIR);
|
||||
}
|
||||
|
@ -158,6 +158,7 @@ private:
|
||||
string_type _s;
|
||||
};
|
||||
|
||||
bool operator<(const path& lhs, const path& rhs);
|
||||
bool operator>(const path& lhs, const path& rhs);
|
||||
|
||||
using file_status = BYTE;
|
||||
@ -178,6 +179,10 @@ struct directory_entry : public FILINFO {
|
||||
return fattrib;
|
||||
}
|
||||
|
||||
std::uintmax_t size() const {
|
||||
return fsize;
|
||||
};
|
||||
|
||||
const std::filesystem::path path() const noexcept { return { fname }; };
|
||||
};
|
||||
|
||||
@ -221,6 +226,7 @@ inline directory_iterator end(const directory_iterator&) noexcept { return { };
|
||||
|
||||
inline bool operator!=(const directory_iterator& lhs, const directory_iterator& rhs) { return lhs.impl != rhs.impl; };
|
||||
|
||||
bool is_directory(const file_status s);
|
||||
bool is_regular_file(const file_status s);
|
||||
|
||||
space_info space(const path& p);
|
||||
|
Loading…
Reference in New Issue
Block a user