add io::directory_iterator

This commit is contained in:
MihailRis
2025-01-31 10:07:05 +03:00
parent c3066eebd3
commit 347d76870a
13 changed files with 182 additions and 64 deletions
+9 -3
View File
@@ -49,6 +49,12 @@ void io::create_subdevice(
set_device(name, std::make_shared<io::SubDevice>(parentDevice, root.pathPart()));
}
io::directory_iterator::directory_iterator(const io::path& folder)
: folder(folder) {
auto& device = io::require_device(folder.entryPoint());
generator = device.list(folder.pathPart());
}
io::rafile::rafile(const io::path& filename)
: file(io::resolve(filename), std::ios::binary | std::ios::ate) {
if (!file) {
@@ -171,7 +177,7 @@ std::vector<std::string> io::read_list(const io::path& filename) {
}
bool io::is_regular_file(const io::path& file) {
if (file.empty()) {
if (file.emptyOrInvalid()) {
return false;
}
auto device = io::get_device(file.entryPoint());
@@ -182,7 +188,7 @@ bool io::is_regular_file(const io::path& file) {
}
bool io::is_directory(const io::path& file) {
if (file.empty()) {
if (file.emptyOrInvalid()) {
return false;
}
auto device = io::get_device(file.entryPoint());
@@ -193,7 +199,7 @@ bool io::is_directory(const io::path& file) {
}
bool io::exists(const io::path& file) {
if (file.empty()) {
if (file.emptyOrInvalid()) {
return false;
}
auto device = io::get_device(file.entryPoint());