summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-07-17 13:49:10 +0200
committerTor Egge <Tor.Egge@online.no>2023-07-17 13:49:10 +0200
commitad6ad6579df67442563eb08131a74f8e1be71a3b (patch)
tree997ba60d58c9a00f4bf870d11e89b4b782225374 /searchlib
parentdab95e8297ce1ddedcd64b57606ad03bfa36dce7 (diff)
Reduce use of vespalib::unlink.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/common/indexmetainfo.cpp5
2 files changed, 8 insertions, 7 deletions
diff --git a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp
index e356187a19f..07b64864d9a 100644
--- a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp
+++ b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp
@@ -13,9 +13,9 @@
#include <vespa/searchlib/test/mock_gid_to_lid_mapping.h>
#include <vespa/searchcommon/attribute/config.h>
#include <vespa/vespalib/gtest/gtest.h>
-#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/test/insertion_operators.h>
#include <cinttypes>
+#include <filesystem>
#include <vespa/log/log.h>
LOG_SETUP("reference_attribute_test");
@@ -312,8 +312,8 @@ TEST_F(ReferenceAttributeTest, attribute_can_be_saved_and_loaded)
assertRef(doc1, 1);
assertRef(doc2, 2);
assertRef(doc1, 4);
- EXPECT_TRUE(vespalib::unlink("test.dat"));
- EXPECT_TRUE(vespalib::unlink("test.udat"));
+ EXPECT_TRUE(std::filesystem::remove(std::filesystem::path("test.dat")));
+ EXPECT_TRUE(std::filesystem::remove(std::filesystem::path("test.udat")));
}
TEST_F(ReferenceAttributeTest, update_uses_gid_mapper_to_set_target_lid)
@@ -399,8 +399,8 @@ TEST_F(ReferenceAttributeTest, populateTargetLids_uses_gid_mapper_to_update_lid_
save();
load();
checkPopulateTargetLids(*this);
- EXPECT_TRUE(vespalib::unlink("test.dat"));
- EXPECT_TRUE(vespalib::unlink("test.udat"));
+ EXPECT_TRUE(std::filesystem::remove(std::filesystem::path("test.dat")));
+ EXPECT_TRUE(std::filesystem::remove(std::filesystem::path("test.udat")));
}
TEST_F(ReferenceAttributeTest, populateTargetLids_handles_removes)
diff --git a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp
index 60d04d7e3ad..42c9ed4e1c6 100644
--- a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp
+++ b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp
@@ -4,8 +4,9 @@
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/guard.h>
-#include <cassert>
#include <algorithm>
+#include <cassert>
+#include <filesystem>
#include <vespa/log/log.h>
LOG_SETUP(".indexmetainfo");
@@ -305,7 +306,7 @@ IndexMetaInfo::save(const vespalib::string &baseName)
{
vespalib::string fileName = makeFileName(baseName);
vespalib::string newName = fileName + ".new";
- vespalib::unlink(newName);
+ std::filesystem::remove(std::filesystem::path(newName));
vespalib::FilePointer f(fopen(newName.c_str(), "w"));
if (!f.valid()) {
LOG(warning, "could not open file for writing: %s", newName.c_str());