aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-08-31 11:32:39 +0200
committerGitHub <noreply@github.com>2023-08-31 11:32:39 +0200
commitf773de5320c8c01aecb2624bf2d62d5f37d86727 (patch)
treeb12a0e496a29e3464548b6967de259e29300312c
parent0b39f020ecd2081091caeabca2ae15b30efcee3a (diff)
parent45a5d057789861d5b247b4e4d5e1c889586e392c (diff)
Merge pull request #28303 from vespa-engine/toregge/use-std-filesystem-directory-iterator-in-attribute-disk-layout
Use std::filesystem::directory_iterator in AttributeDiskLayout.
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp
index 04e263ae20b..40b24f2ec26 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp
@@ -3,7 +3,6 @@
#include "attributedisklayout.h"
#include "attribute_directory.h"
#include <vespa/vespalib/io/fileutil.h>
-#include <vespa/fastos/file.h>
#include <cassert>
#include <filesystem>
@@ -34,12 +33,10 @@ AttributeDiskLayout::listAttributes()
void
AttributeDiskLayout::scanDir()
{
- FastOS_DirectoryScan dir(_baseDir.c_str());
- while (dir.ReadNext()) {
- if (strcmp(dir.GetName(), "..") != 0 && strcmp(dir.GetName(), ".") != 0) {
- if (dir.IsDirectory()) {
- createAttributeDir(dir.GetName());
- }
+ std::filesystem::directory_iterator dir_scan{std::filesystem::path(_baseDir)};
+ for (auto& entry : dir_scan) {
+ if (entry.is_directory()) {
+ createAttributeDir(entry.path().filename().string());
}
}
}