summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-08-31 11:26:17 +0200
committerTor Egge <Tor.Egge@online.no>2023-08-31 11:26:17 +0200
commit7f0661a8e744ece3565c211da245b397bdd5fb27 (patch)
tree15c051bc469394925cd2a85d281cb7cacf693a2a /searchlib
parent8ea84bc51e83f76f2b77ba98b49e4d03b0351214 (diff)
Use std::filesystem::directory_iterator in LogDataStore.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/docstore/logdatastore.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
index c4b5d9c2145..a187e690158 100644
--- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
@@ -891,10 +891,10 @@ LogDataStore::NameIdSet
LogDataStore::scanDir(const vespalib::string &dir, const vespalib::string &suffix)
{
NameIdSet baseFiles;
- FastOS_DirectoryScan dirScan(dir.c_str());
- while (dirScan.ReadNext()) {
- if (dirScan.IsRegular()) {
- vespalib::stringref file(dirScan.GetName());
+ std::filesystem::directory_iterator dir_scan{std::filesystem::path(dir)};
+ for (auto& entry : dir_scan) {
+ if (entry.is_regular_file()) {
+ vespalib::string file(entry.path().filename().string());
if (file.size() > suffix.size() &&
file.find(suffix.c_str()) == file.size() - suffix.size()) {
vespalib::string base(file.substr(0, file.find(suffix.c_str())));
@@ -911,7 +911,7 @@ LogDataStore::scanDir(const vespalib::string &dir, const vespalib::string &suffi
base.c_str(), err, getLastErrorString().c_str()));
}
} else {
- LOG(debug, "Skipping '%s' since it does not end with '%s'", file.data(), suffix.c_str());
+ LOG(debug, "Skipping '%s' since it does not end with '%s'", file.c_str(), suffix.c_str());
}
}
}