GitOrigin-RevId: 14f5e0e38a771f42213ab544ef065da86425dbc5
This commit is contained in:
Arseny Smirnov 2019-05-04 19:05:17 +02:00
parent 7831955779
commit 1aa86c15be
2 changed files with 15 additions and 10 deletions

View File

@ -223,10 +223,10 @@ class CreateFileBench : public Benchmark {
}
void tear_down() override {
td::walk_path("A/",
[&](CSlice path, bool is_dir) {
if (is_dir) {
[&](CSlice path, auto type) {
if (type == td::WalkPath::Type::ExitDir) {
rmdir(path).ignore();
} else {
} else if (type == td::WalkPath::Type::NotDir) {
unlink(path).ignore();
}
})
@ -247,7 +247,10 @@ class WalkPathBench : public Benchmark {
void run(int n) override {
int cnt = 0;
td::walk_path("A/",
[&](CSlice path, bool is_dir) {
[&](CSlice path, auto type) {
if (type == td::WalkPath::Type::EnterDir) {
return;
}
stat(path).ok();
cnt++;
})
@ -255,10 +258,10 @@ class WalkPathBench : public Benchmark {
}
void tear_down() override {
td::walk_path("A/",
[&](CSlice path, bool is_dir) {
if (is_dir) {
[&](CSlice path, auto type) {
if (type == td::WalkPath::Type::ExitDir) {
rmdir(path).ignore();
} else {
} else if (type == td::WalkPath::Type::NotDir) {
unlink(path).ignore();
}
})

View File

@ -14,9 +14,11 @@ int main(int argc, char *argv[]) {
}
td::CSlice dir(argv[1]);
int cnt = 0;
auto status = td::walk_path(dir, [&](td::CSlice path, bool is_dir) {
cnt++;
LOG(INFO) << path << " " << is_dir;
auto status = td::walk_path(dir, [&](td::CSlice path, auto type) {
if (type != td::WalkPath::Type::EnterDir) {
cnt++;
LOG(INFO) << path << " " << (type == td::WalkPath::Type::ExitDir);
}
//if (is_dir) {
// td::rmdir(path);
//} else {