mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-13 19:56:40 +00:00
File: Add misc useful API from C++17.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user