mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-03 17:56:12 -04:00
fix: compatibility with boost process v2
This commit is contained in:
parent
93368a4065
commit
a622d89f9c
@ -32,12 +32,14 @@
|
|||||||
#include <folly/portability/PThread.h>
|
#include <folly/portability/PThread.h>
|
||||||
#include <folly/portability/Unistd.h>
|
#include <folly/portability/Unistd.h>
|
||||||
|
|
||||||
#if __has_include(<boost/process/v1/search_path.hpp>)
|
#if __has_include(<boost/process/v2/environment.hpp>) && defined(DWARFS_HAVE_CLOSE_RANGE)
|
||||||
|
#define BOOST_PROCESS_VERSION 2
|
||||||
|
#include <boost/process/v2/environment.hpp>
|
||||||
|
#elif __has_include(<boost/process/v1/search_path.hpp>)
|
||||||
|
#define BOOST_PROCESS_VERSION 1
|
||||||
#include <boost/process/v1/search_path.hpp>
|
#include <boost/process/v1/search_path.hpp>
|
||||||
#define DWARFS_BOOST_PROCESS_SEARCH_PATH_V1 1
|
|
||||||
#else
|
#else
|
||||||
#include <boost/process/search_path.hpp>
|
#include <boost/process/search_path.hpp>
|
||||||
#define DWARFS_BOOST_PROCESS_SEARCH_PATH_V1 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@ -233,12 +235,12 @@ os_access_generic::thread_get_cpu_time(std::thread::id tid,
|
|||||||
|
|
||||||
std::filesystem::path
|
std::filesystem::path
|
||||||
os_access_generic::find_executable(std::filesystem::path const& name) const {
|
os_access_generic::find_executable(std::filesystem::path const& name) const {
|
||||||
#if DWARFS_BOOST_PROCESS_SEARCH_PATH_V1
|
#if BOOST_PROCESS_VERSION == 2
|
||||||
using boost::process::v1::search_path;
|
return boost::process::v2::environment::find_executable(name.wstring())
|
||||||
|
.wstring();
|
||||||
#else
|
#else
|
||||||
using boost::process::search_path;
|
return boost::process::search_path(name.wstring()).wstring();
|
||||||
#endif
|
#endif
|
||||||
return search_path(name.wstring()).wstring();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dwarfs
|
} // namespace dwarfs
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
|
#include <deque>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <future>
|
#include <future>
|
||||||
@ -49,7 +50,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/asio/io_context.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
|
#if __has_include(<boost/process/v1/args.hpp>)
|
||||||
|
#define BOOST_PROCESS_VERSION 1
|
||||||
|
#include <boost/process/v1/args.hpp>
|
||||||
|
#include <boost/process/v1/async.hpp>
|
||||||
|
#include <boost/process/v1/child.hpp>
|
||||||
|
#include <boost/process/v1/io.hpp>
|
||||||
|
#else
|
||||||
#include <boost/process.hpp>
|
#include <boost/process.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#if FMT_VERSION >= 110000
|
#if FMT_VERSION >= 110000
|
||||||
|
@ -44,16 +44,6 @@
|
|||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#if __has_include(<boost/process/v2/environment.hpp>) && defined(DWARFS_HAVE_CLOSE_RANGE)
|
|
||||||
#define BOOST_PROCESS_VERSION 2
|
|
||||||
#include <boost/process/v2/environment.hpp>
|
|
||||||
#else
|
|
||||||
#define BOOST_PROCESS_VERSION 1
|
|
||||||
#include <boost/process/search_path.hpp>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include <dwarfs/config.h>
|
#include <dwarfs/config.h>
|
||||||
@ -99,7 +89,7 @@
|
|||||||
#include <dwarfs/library_dependencies.h>
|
#include <dwarfs/library_dependencies.h>
|
||||||
#include <dwarfs/logger.h>
|
#include <dwarfs/logger.h>
|
||||||
#include <dwarfs/mmap.h>
|
#include <dwarfs/mmap.h>
|
||||||
#include <dwarfs/os_access.h>
|
#include <dwarfs/os_access_generic.h>
|
||||||
#include <dwarfs/performance_monitor.h>
|
#include <dwarfs/performance_monitor.h>
|
||||||
#include <dwarfs/reader/cache_tidy_config.h>
|
#include <dwarfs/reader/cache_tidy_config.h>
|
||||||
#include <dwarfs/reader/filesystem_options.h>
|
#include <dwarfs/reader/filesystem_options.h>
|
||||||
@ -435,14 +425,10 @@ void check_fusermount(dwarfs_userdata& userdata) {
|
|||||||
static constexpr std::string_view const fuse_pkg = "fuse/fuse2";
|
static constexpr std::string_view const fuse_pkg = "fuse/fuse2";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOOST_PROCESS_VERSION == 2
|
|
||||||
auto fusermount =
|
auto fusermount =
|
||||||
boost::process::v2::environment::find_executable(fusermount_name);
|
dwarfs::os_access_generic().find_executable(fusermount_name);
|
||||||
#else
|
|
||||||
auto fusermount = boost::process::search_path(std::string(fusermount_name));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fusermount.empty() || !boost::filesystem::exists(fusermount)) {
|
if (fusermount.empty() || !std::filesystem::exists(fusermount)) {
|
||||||
LOG_PROXY(prod_logger_policy, userdata.lgr);
|
LOG_PROXY(prod_logger_policy, userdata.lgr);
|
||||||
LOG_ERROR << "Could not find `" << fusermount_name << "' in PATH";
|
LOG_ERROR << "Could not find `" << fusermount_name << "' in PATH";
|
||||||
LOG_WARN << "Do you need to install the `" << fuse_pkg << "' package?";
|
LOG_WARN << "Do you need to install the `" << fuse_pkg << "' package?";
|
||||||
|
@ -31,7 +31,15 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <boost/asio/io_context.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
|
#if __has_include(<boost/process/v1/args.hpp>)
|
||||||
|
#define BOOST_PROCESS_VERSION 1
|
||||||
|
#include <boost/process/v1/args.hpp>
|
||||||
|
#include <boost/process/v1/async.hpp>
|
||||||
|
#include <boost/process/v1/child.hpp>
|
||||||
|
#include <boost/process/v1/io.hpp>
|
||||||
|
#else
|
||||||
#include <boost/process.hpp>
|
#include <boost/process.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <dwarfs/os_access.h>
|
#include <dwarfs/os_access.h>
|
||||||
#include <dwarfs/tool/pager.h>
|
#include <dwarfs/tool/pager.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user