2016-01-31 22:19:23 +00:00
|
|
|
#include <ostd/io.hh>
|
|
|
|
#include <ostd/filesystem.hh>
|
2016-07-31 19:40:25 +00:00
|
|
|
#include <ostd/range.hh>
|
2016-01-31 22:19:23 +00:00
|
|
|
|
|
|
|
using namespace ostd;
|
|
|
|
|
2017-03-10 17:19:59 +00:00
|
|
|
void list_dirs(filesystem::path const &path, int off = 0) {
|
|
|
|
filesystem::directory_iterator ds{path};
|
|
|
|
for (auto &v: ds) {
|
|
|
|
auto p = filesystem::path{v};
|
|
|
|
if (!filesystem::is_directory(p)) {
|
2016-01-31 22:19:23 +00:00
|
|
|
continue;
|
2016-07-31 19:40:25 +00:00
|
|
|
}
|
|
|
|
for_each(range(off), [](int) { write(' '); });
|
2017-03-10 17:19:59 +00:00
|
|
|
writeln(p.filename());
|
|
|
|
list_dirs(p, off + 1);
|
2016-01-31 22:19:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2016-07-31 19:40:25 +00:00
|
|
|
if (argc < 1) {
|
|
|
|
return 1;
|
|
|
|
}
|
2016-01-31 22:19:23 +00:00
|
|
|
list_dirs(argv[1]);
|
|
|
|
return 0;
|
2016-02-07 21:17:15 +00:00
|
|
|
}
|