diff options
author | Tor Egge <Tor.Egge@online.no> | 2022-06-03 11:04:53 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2022-06-03 11:04:53 +0200 |
commit | b8fe992cb905b0b2736f298f889cfa70bcea5961 (patch) | |
tree | c60e2a5637e46c0bb00ffe38fd792755acd966ef /storage | |
parent | 54b80fbeb0d6b1f05135f18740423614f719a418 (diff) |
Remove most use of vespalib::rmdir
Diffstat (limited to 'storage')
4 files changed, 12 insertions, 12 deletions
diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp index d2a4f994bda..cff62542434 100644 --- a/storage/src/tests/common/metricstest.cpp +++ b/storage/src/tests/common/metricstest.cpp @@ -13,9 +13,9 @@ #include <vespa/metrics/metricmanager.h> #include <vespa/config/common/exceptions.h> #include <vespa/vespalib/stllike/hash_map.hpp> -#include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/gtest/gtest.h> #include <gmock/gmock.h> +#include <filesystem> #include <thread> #include <vespa/log/log.h> @@ -71,7 +71,7 @@ MetricsTest::~MetricsTest() = default; void MetricsTest::SetUp() { _config = std::make_unique<vdstestlib::DirConfig>(getStandardConfig(true, "metricstest")); - vespalib::rmdir(getRootFolder(*_config), true); + std::filesystem::remove_all(std::filesystem::path(getRootFolder(*_config))); try { _node = std::make_unique<TestServiceLayerApp>(NodeIndex(0), _config->getConfigId()); _node->setupDummyPersistence(); diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp index b069ac078ef..940436307a1 100644 --- a/storage/src/tests/persistence/persistencetestutils.cpp +++ b/storage/src/tests/persistence/persistencetestutils.cpp @@ -11,11 +11,11 @@ #include <vespa/persistence/spi/test.h> #include <vespa/storage/persistence/filestorage/filestorhandlerimpl.h> #include <vespa/storage/persistence/persistencehandler.h> -#include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/sequencedtaskexecutor.h> #include <vespa/config-stor-filestor.h> +#include <filesystem> #include <thread> using document::DocumentType; @@ -29,8 +29,8 @@ namespace { vdstestlib::DirConfig initialize(const std::string & rootOfRoot) { vdstestlib::DirConfig config(getStandardConfig(true, rootOfRoot)); std::string rootFolder = getRootFolder(config); - vespalib::rmdir(rootFolder, true); - vespalib::mkdir(vespalib::make_string("%s/disks/d0", rootFolder.c_str()), true); + std::filesystem::remove_all(std::filesystem::path(rootFolder)); + std::filesystem::create_directories(std::filesystem::path(vespalib::make_string("%s/disks/d0", rootFolder.c_str()))); return config; } diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index 4de7df7b366..7dc34bb4b6f 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -18,8 +18,8 @@ #include <tests/common/dummystoragelink.h> #include <tests/storageserver/testvisitormessagesession.h> #include <vespa/persistence/spi/docentry.h> -#include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/gtest/gtest.h> +#include <filesystem> #include <thread> #include <sys/stat.h> @@ -153,9 +153,9 @@ VisitorTest::initializeTest(const TestParams& params) std::string rootFolder = getRootFolder(config); ::chmod(rootFolder.c_str(), 0755); - vespalib::rmdir(rootFolder, true); - vespalib::mkdir(vespalib::make_string("%s/disks/d0", rootFolder.c_str()), true); - vespalib::mkdir(vespalib::make_string("%s/disks/d1", rootFolder.c_str()), true); + std::filesystem::remove_all(std::filesystem::path(rootFolder)); + std::filesystem::create_directories(std::filesystem::path(vespalib::make_string("%s/disks/d0", rootFolder.c_str()))); + std::filesystem::create_directories(std::filesystem::path(vespalib::make_string("%s/disks/d1", rootFolder.c_str()))); _messageSessionFactory.reset( new TestVisitorMessageSessionFactory(config.getConfigId())); diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp index a4701d9f396..cc433ea4ee5 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.cpp +++ b/storage/src/vespa/storage/storageserver/storagenode.cpp @@ -16,10 +16,10 @@ #include <vespa/storage/frameworkimpl/thread/deadlockdetector.h> #include <vespa/config/helper/configfetcher.hpp> #include <vespa/vdslib/distribution/distribution.h> -#include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/time.h> #include <fcntl.h> +#include <filesystem> #include <vespa/log/log.h> @@ -41,7 +41,7 @@ namespace { vespalib::string mypid = vespalib::make_string("%d\n", getpid()); size_t lastSlash = pidfile.rfind('/'); if (lastSlash != vespalib::string::npos) { - vespalib::mkdir(pidfile.substr(0, lastSlash)); + std::filesystem::create_directories(std::filesystem::path(pidfile.substr(0, lastSlash))); } int fd = open(pidfile.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd != -1) { @@ -172,7 +172,7 @@ StorageNode::initialize() // Create VDS root folder, in case it doesn't already exist. // Maybe better to rather fail if it doesn't exist, but tests // might break if we do that. Might alter later. - vespalib::mkdir(_rootFolder); + std::filesystem::create_directories(std::filesystem::path(_rootFolder)); initializeNodeSpecific(); |