Switch to std::filesystem
Change-Id: If70258048d6f54c3e9f0a25bf8f3e327411c42ac
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
index ef5ab5c..106797b 100644
--- a/tests/identity-management-fixture.cpp
+++ b/tests/identity-management-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California.
+ * Copyright (c) 2014-2024, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -25,7 +25,7 @@
#include <ndn-cxx/security/certificate.hpp>
#include <ndn-cxx/util/io.hpp>
-#include <boost/filesystem.hpp>
+#include <filesystem>
namespace repo::tests {
@@ -37,9 +37,9 @@
IdentityManagementFixture::~IdentityManagementFixture()
{
- boost::system::error_code ec;
+ std::error_code ec;
for (const auto& certFile : m_certFiles) {
- boost::filesystem::remove(certFile, ec); // ignore error
+ std::filesystem::remove(certFile, ec); // ignore error
}
}
diff --git a/tests/repo-storage-fixture.hpp b/tests/repo-storage-fixture.hpp
index f573736..83b3f3f 100644
--- a/tests/repo-storage-fixture.hpp
+++ b/tests/repo-storage-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2018-2022, Regents of the University of California.
+ * Copyright (c) 2018-2024, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -23,27 +23,22 @@
#include "storage/repo-storage.hpp"
#include "storage/sqlite-storage.hpp"
-#include <boost/filesystem.hpp>
+#include <filesystem>
namespace repo::tests {
class RepoStorageFixture
{
public:
- RepoStorageFixture()
- : store(std::make_shared<SqliteStorage>("unittestdb"))
- , handle(std::make_shared<RepoStorage>(*store))
- {
- }
-
~RepoStorageFixture()
{
- boost::filesystem::remove_all(boost::filesystem::path("unittestdb"));
+ std::error_code ec;
+ std::filesystem::remove_all(std::filesystem::path("unittestdb"), ec);
}
public:
- std::shared_ptr<Storage> store;
- std::shared_ptr<RepoStorage> handle;
+ std::shared_ptr<Storage> store = std::make_shared<SqliteStorage>("unittestdb");
+ std::shared_ptr<RepoStorage> handle = std::make_shared<RepoStorage>(*store);
};
} // namespace repo::tests
diff --git a/tests/sqlite-fixture.hpp b/tests/sqlite-fixture.hpp
index c478d64..dbe5ea0 100644
--- a/tests/sqlite-fixture.hpp
+++ b/tests/sqlite-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California.
+ * Copyright (c) 2014-2024, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -22,26 +22,22 @@
#include "storage/sqlite-storage.hpp"
-#include <boost/filesystem.hpp>
+#include <filesystem>
namespace repo::tests {
class SqliteFixture
{
public:
- SqliteFixture()
- : handle(new SqliteStorage("unittestdb"))
- {
- }
-
~SqliteFixture()
{
- delete handle;
- boost::filesystem::remove_all(boost::filesystem::path("unittestdb"));
+ handle.reset();
+ std::error_code ec;
+ std::filesystem::remove_all(std::filesystem::path("unittestdb"), ec);
}
public:
- SqliteStorage* handle;
+ std::unique_ptr<SqliteStorage> handle = std::make_unique<SqliteStorage>("unittestdb");
};
} // namespace repo::tests