mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 12:30:00 +02:00
Replace most uses of Boost.{Filesystem,Process}
With the `ghc::filesystem` dependency from the previous commit. If we can replace the rest of the Boost.Filesystem dependency then we can get rid the one nasty runtime dependency we have, and it will make implementing the chainloading simpler since can reuse more code without bringing in Boost.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "../utils.h"
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
namespace fs = ghc::filesystem;
|
||||
|
||||
/**
|
||||
* Used for generating random identifiers.
|
||||
@@ -28,7 +28,7 @@ namespace fs = boost::filesystem;
|
||||
constexpr char alphanumeric_characters[] =
|
||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
boost::filesystem::path generate_endpoint_base(const std::string& plugin_name) {
|
||||
ghc::filesystem::path generate_endpoint_base(const std::string& plugin_name) {
|
||||
fs::path temp_directory = get_temporary_directory();
|
||||
|
||||
std::random_device random_device;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <boost/asio/read.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <ghc/filesystem.hpp>
|
||||
|
||||
#include "../bitsery/traits/small-vector.h"
|
||||
#include "../logging/common.h"
|
||||
@@ -268,7 +268,7 @@ inline T read_object(Socket& socket) {
|
||||
* @param plugin_name The name of the plugin we're generating endpoints for.
|
||||
* Used as a visual indication of what plugin is using this endpoint.
|
||||
*/
|
||||
boost::filesystem::path generate_endpoint_base(const std::string& plugin_name);
|
||||
ghc::filesystem::path generate_endpoint_base(const std::string& plugin_name);
|
||||
|
||||
/**
|
||||
* Manages all the sockets used for communicating between the plugin and the
|
||||
@@ -287,7 +287,7 @@ class Sockets {
|
||||
*
|
||||
* @see Sockets::connect
|
||||
*/
|
||||
Sockets(const boost::filesystem::path& endpoint_base_dir)
|
||||
Sockets(const ghc::filesystem::path& endpoint_base_dir)
|
||||
: base_dir_(endpoint_base_dir) {}
|
||||
|
||||
/**
|
||||
@@ -305,9 +305,9 @@ class Sockets {
|
||||
// there's now a safeguard against that very thing. Hopefully
|
||||
// this should never be needed, but if it is, then I'm glad
|
||||
// we'll have it!
|
||||
const boost::filesystem::path temp_dir = get_temporary_directory();
|
||||
const ghc::filesystem::path temp_dir = get_temporary_directory();
|
||||
if (base_dir_.string().starts_with(temp_dir.string())) {
|
||||
boost::filesystem::remove_all(base_dir_);
|
||||
ghc::filesystem::remove_all(base_dir_);
|
||||
} else {
|
||||
Logger logger = Logger::create_exception_logger();
|
||||
|
||||
@@ -317,7 +317,7 @@ class Sockets {
|
||||
"'");
|
||||
logger.log("");
|
||||
}
|
||||
} catch (const boost::filesystem::filesystem_error&) {
|
||||
} catch (const ghc::filesystem::filesystem_error&) {
|
||||
// There should not be any filesystem errors since only one side
|
||||
// removes the files, but if we somehow can't delete the file
|
||||
// then we can just silently ignore this
|
||||
@@ -351,7 +351,7 @@ class Sockets {
|
||||
* The base directory for our socket endpoints. All `*_endpoint` variables
|
||||
* below are files within this directory.
|
||||
*/
|
||||
const boost::filesystem::path base_dir_;
|
||||
const ghc::filesystem::path base_dir_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -376,8 +376,8 @@ class SocketHandler {
|
||||
bool listen)
|
||||
: endpoint_(endpoint), socket_(io_context) {
|
||||
if (listen) {
|
||||
boost::filesystem::create_directories(
|
||||
boost::filesystem::path(endpoint.path()).parent_path());
|
||||
ghc::filesystem::create_directories(
|
||||
ghc::filesystem::path(endpoint.path()).parent_path());
|
||||
acceptor_.emplace(io_context, endpoint);
|
||||
}
|
||||
}
|
||||
@@ -577,8 +577,8 @@ class AdHocSocketHandler {
|
||||
bool listen)
|
||||
: io_context_(io_context), endpoint_(endpoint), socket_(io_context) {
|
||||
if (listen) {
|
||||
boost::filesystem::create_directories(
|
||||
boost::filesystem::path(endpoint.path()).parent_path());
|
||||
ghc::filesystem::create_directories(
|
||||
ghc::filesystem::path(endpoint.path()).parent_path());
|
||||
acceptor_.emplace(io_context, endpoint);
|
||||
}
|
||||
}
|
||||
@@ -598,7 +598,7 @@ class AdHocSocketHandler {
|
||||
// potentially on the other side of the connection in the case
|
||||
// where we're handling `vst_host_callback_` VST2 events
|
||||
acceptor_.reset();
|
||||
boost::filesystem::remove(endpoint_.path());
|
||||
ghc::filesystem::remove(endpoint_.path());
|
||||
} else {
|
||||
socket_.connect(endpoint_);
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ class Vst2Sockets final : public Sockets {
|
||||
* @see Vst2Sockets::connect
|
||||
*/
|
||||
Vst2Sockets(boost::asio::io_context& io_context,
|
||||
const boost::filesystem::path& endpoint_base_dir,
|
||||
const ghc::filesystem::path& endpoint_base_dir,
|
||||
bool listen)
|
||||
: Sockets(endpoint_base_dir),
|
||||
host_vst_dispatch_(io_context,
|
||||
|
||||
@@ -311,7 +311,7 @@ class Vst3Sockets final : public Sockets {
|
||||
* @see Vst3Sockets::connect
|
||||
*/
|
||||
Vst3Sockets(boost::asio::io_context& io_context,
|
||||
const boost::filesystem::path& endpoint_base_dir,
|
||||
const ghc::filesystem::path& endpoint_base_dir,
|
||||
bool listen)
|
||||
: Sockets(endpoint_base_dir),
|
||||
host_vst_control_(io_context,
|
||||
|
||||
Reference in New Issue
Block a user