diff --git a/build.cc b/build.cc index 445fcc7..1ee5a89 100644 --- a/build.cc +++ b/build.cc @@ -28,7 +28,7 @@ namespace fs = ostd::filesystem; /* ugly, but do not explicitly compile */ #include "src/io.cc" #include "src/process.cc" -#include "srC/path.cc" +#include "src/path.cc" #include "src/filesystem.cc" #include "src/thread_pool.cc" #include "src/channel.cc" diff --git a/examples/listdir.cc b/examples/listdir.cc index 91e3ae0..5cc911e 100644 --- a/examples/listdir.cc +++ b/examples/listdir.cc @@ -4,21 +4,20 @@ */ #include -#include +#include #include using namespace ostd; -inline void list_dirs(filesystem::path const &path, int off = 0) { - filesystem::directory_iterator ds{path}; +inline void list_dirs(path const &path, int off = 0) { + fs::directory_range ds{path}; for (auto &v: ds) { - auto p = filesystem::path{v}; - if (!filesystem::is_directory(p)) { + if (!fs::is_directory(v.path())) { continue; } for_each(range(off), [](int) { write(' '); }); - writeln(p.filename()); - list_dirs(p, off + 1); + writeln(v.path().name()); + list_dirs(v.path(), off + 1); } } diff --git a/src/posix/path.cc b/src/posix/path.cc index 3ced4b0..8963ae0 100644 --- a/src/posix/path.cc +++ b/src/posix/path.cc @@ -150,6 +150,7 @@ OSTD_EXPORT void rdir_range_impl::read_next() { if (p_handles.empty()) { return; } + /* can't reuse info from dirent because we need to expand symlinks */ if (is_directory(p_current.path())) { /* directory, recurse into it and if it contains stuff, return */ DIR *nd = opendir(p_current.path().string().data());