Replace boost::filesystem with std (#6432)

This commit is contained in:
Dennis Luxen
2024-06-20 21:44:28 +02:00
committed by GitHub
parent c3f2a6cdb9
commit f1eabc3ecc
64 changed files with 417 additions and 311 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ extern "C"
#include <lualib.h>
}
#include <boost/filesystem.hpp>
#include <filesystem>
#include <string>
@@ -20,7 +20,7 @@ namespace osrm::util
// See http://lua-users.org/wiki/PackagePath for details on the package.path syntax.
inline void luaAddScriptFolderToLoadPath(lua_State *lua_state, const char *file_name)
{
boost::filesystem::path profile_path = boost::filesystem::canonical(file_name);
std::filesystem::path profile_path = std::filesystem::canonical(file_name);
std::string folder = profile_path.parent_path().generic_string();
const std::string lua_code = "package.path = \"" + folder + "/?.lua;\" .. package.path";
luaL_dostring(lua_state, lua_code.c_str());
+10 -9
View File
@@ -5,20 +5,22 @@
#include "util/exception_utils.hpp"
#include "util/vector_view.hpp"
#include <boost/filesystem/path.hpp>
#include <boost/iostreams/device/mapped_file.hpp>
#include <filesystem>
namespace osrm::util
{
namespace detail
{
template <typename T, typename MmapContainerT>
util::vector_view<T> mmapFile(const boost::filesystem::path &file, MmapContainerT &mmap_container)
util::vector_view<T> mmapFile(const std::filesystem::path &file, MmapContainerT &mmap_container)
{
try
{
mmap_container.open(file);
auto path_string = file.string();
mmap_container.open(path_string);
std::size_t num_objects = mmap_container.size() / sizeof(T);
auto data_ptr = mmap_container.data();
BOOST_ASSERT(reinterpret_cast<uintptr_t>(data_ptr) % alignof(T) == 0);
@@ -33,9 +35,8 @@ util::vector_view<T> mmapFile(const boost::filesystem::path &file, MmapContainer
}
template <typename T, typename MmapContainerT>
util::vector_view<T> mmapFile(const boost::filesystem::path &file,
MmapContainerT &mmap_container,
const std::size_t size)
util::vector_view<T>
mmapFile(const std::filesystem::path &file, MmapContainerT &mmap_container, const std::size_t size)
{
try
{
@@ -61,21 +62,21 @@ util::vector_view<T> mmapFile(const boost::filesystem::path &file,
} // namespace detail
template <typename T>
util::vector_view<const T> mmapFile(const boost::filesystem::path &file,
util::vector_view<const T> mmapFile(const std::filesystem::path &file,
boost::iostreams::mapped_file_source &mmap_container)
{
return detail::mmapFile<const T>(file, mmap_container);
}
template <typename T>
util::vector_view<T> mmapFile(const boost::filesystem::path &file,
util::vector_view<T> mmapFile(const std::filesystem::path &file,
boost::iostreams::mapped_file &mmap_container)
{
return detail::mmapFile<T>(file, mmap_container);
}
template <typename T>
util::vector_view<T> mmapFile(const boost::filesystem::path &file,
util::vector_view<T> mmapFile(const std::filesystem::path &file,
boost::iostreams::mapped_file &mmap_container,
std::size_t size)
{
+1 -1
View File
@@ -15,7 +15,7 @@ namespace osrm::util
using DataRange = std::pair<const char *, const char *>;
using DataMap = std::unordered_map<std::string, DataRange>;
inline DataMap mmapTarFile(const boost::filesystem::path &path,
inline DataMap mmapTarFile(const std::filesystem::path &path,
boost::iostreams::mapped_file_source &region)
{
DataMap map;
+4 -4
View File
@@ -20,7 +20,6 @@
#include "storage/shared_memory_ownership.hpp"
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/iostreams/device/mapped_file.hpp>
@@ -30,6 +29,7 @@
#include <algorithm>
#include <array>
#include <filesystem>
#include <limits>
#include <memory>
#include <queue>
@@ -271,7 +271,7 @@ class StaticRTree
// Construct a packed Hilbert-R-Tree with Kamel-Faloutsos algorithm [1]
explicit StaticRTree(const std::vector<EdgeDataT> &input_data_vector,
const Vector<Coordinate> &coordinate_list,
const boost::filesystem::path &on_disk_file_name)
const std::filesystem::path &on_disk_file_name)
: m_coordinate_list(coordinate_list.data(), coordinate_list.size())
{
const auto element_count = input_data_vector.size();
@@ -458,7 +458,7 @@ class StaticRTree
* Constructs an empty RTree for de-serialization.
*/
template <typename = std::enable_if<Ownership == storage::Ownership::Container>>
explicit StaticRTree(const boost::filesystem::path &on_disk_file_name,
explicit StaticRTree(const std::filesystem::path &on_disk_file_name,
const Vector<Coordinate> &coordinate_list)
: m_coordinate_list(coordinate_list.data(), coordinate_list.size()),
m_objects(mmapFile<EdgeDataT>(on_disk_file_name, m_objects_region))
@@ -473,7 +473,7 @@ class StaticRTree
*/
explicit StaticRTree(Vector<TreeNode> search_tree_,
Vector<std::uint64_t> tree_level_starts,
const boost::filesystem::path &on_disk_file_name,
const std::filesystem::path &on_disk_file_name,
const Vector<Coordinate> &coordinate_list)
: m_search_tree(std::move(search_tree_)),
m_coordinate_list(coordinate_list.data(), coordinate_list.size()),
+2 -2
View File
@@ -3,13 +3,13 @@
#include "util/log.hpp"
#include <boost/filesystem/path.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <rapidjson/document.h>
#include <chrono>
#include <filesystem>
#include <optional>
namespace osrm::updater
@@ -32,7 +32,7 @@ class Timezoner
Timezoner() = default;
Timezoner(const char geojson[], std::time_t utc_time_now);
Timezoner(const boost::filesystem::path &tz_shapes_filename, std::time_t utc_time_now);
Timezoner(const std::filesystem::path &tz_shapes_filename, std::time_t utc_time_now);
std::optional<struct tm> operator()(const point_t &point) const;