mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +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:
@@ -46,8 +46,10 @@ compiler_options = [
|
|||||||
'-fvisibility-inlines-hidden',
|
'-fvisibility-inlines-hidden',
|
||||||
# Disable the use of concepts in Boost.Asio until Boost 1.73 gets released
|
# Disable the use of concepts in Boost.Asio until Boost 1.73 gets released
|
||||||
# https://github.com/boostorg/asio/issues/312
|
# https://github.com/boostorg/asio/issues/312
|
||||||
|
# TODO: Rename after switching to non-Boost ASIO
|
||||||
'-DBOOST_ASIO_DISABLE_CONCEPTS',
|
'-DBOOST_ASIO_DISABLE_CONCEPTS',
|
||||||
# Boost.Process's auto detection for vfork() support doesn't seem to work
|
# Boost.Process's auto detection for vfork() support doesn't seem to work
|
||||||
|
# TODO: Remove after adding our own library
|
||||||
'-DBOOST_POSIX_HAS_VFORK=1',
|
'-DBOOST_POSIX_HAS_VFORK=1',
|
||||||
# We use an intrinsic to force flush-to-zero. SSE2 is always enabled in x86_64
|
# We use an intrinsic to force flush-to-zero. SSE2 is always enabled in x86_64
|
||||||
# CPUs, but when we're compiling the 32-bit bitbridge we need to manually add
|
# CPUs, but when we're compiling the 32-bit bitbridge we need to manually add
|
||||||
@@ -242,6 +244,7 @@ else
|
|||||||
bitsery_dep = dependency('bitsery', version : '>=5.2.0')
|
bitsery_dep = dependency('bitsery', version : '>=5.2.0')
|
||||||
endif
|
endif
|
||||||
function2_dep = dependency('function2', version : '>=4.0.0')
|
function2_dep = dependency('function2', version : '>=4.0.0')
|
||||||
|
ghc_filesystem_dep = dependency('ghc_filesystem', version : '>=1.5.0')
|
||||||
threads_dep = dependency('threads')
|
threads_dep = dependency('threads')
|
||||||
tomlplusplus_dep = dependency('tomlplusplus', version : '>=2.0.0')
|
tomlplusplus_dep = dependency('tomlplusplus', version : '>=2.0.0')
|
||||||
|
|
||||||
@@ -298,6 +301,7 @@ shared_library(
|
|||||||
: boost_filesystem_64bit_dep,
|
: boost_filesystem_64bit_dep,
|
||||||
bitsery_dep,
|
bitsery_dep,
|
||||||
dl_dep,
|
dl_dep,
|
||||||
|
ghc_filesystem_dep,
|
||||||
rt_dep,
|
rt_dep,
|
||||||
threads_dep,
|
threads_dep,
|
||||||
tomlplusplus_dep,
|
tomlplusplus_dep,
|
||||||
@@ -323,6 +327,7 @@ if with_vst3
|
|||||||
bitsery_dep,
|
bitsery_dep,
|
||||||
dl_dep,
|
dl_dep,
|
||||||
function2_dep,
|
function2_dep,
|
||||||
|
ghc_filesystem_dep,
|
||||||
rt_dep,
|
rt_dep,
|
||||||
threads_dep,
|
threads_dep,
|
||||||
tomlplusplus_dep,
|
tomlplusplus_dep,
|
||||||
|
|||||||
@@ -16,10 +16,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef __WINE__
|
#include <ghc/filesystem.hpp>
|
||||||
#include "../wine-host/boost-fix.h"
|
|
||||||
#endif
|
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
|
|
||||||
#include <bitsery/details/serialization_common.h>
|
#include <bitsery/details/serialization_common.h>
|
||||||
#include <bitsery/traits/core/traits.h>
|
#include <bitsery/traits/core/traits.h>
|
||||||
@@ -31,17 +28,17 @@ namespace ext {
|
|||||||
* An adapter for serializing and deserializing filesystem paths since they're
|
* An adapter for serializing and deserializing filesystem paths since they're
|
||||||
* not mutable.
|
* not mutable.
|
||||||
*/
|
*/
|
||||||
class BoostPath {
|
class GhcPath {
|
||||||
public:
|
public:
|
||||||
template <typename Ser, typename Fnc>
|
template <typename Ser, typename Fnc>
|
||||||
void serialize(Ser& ser, const boost::filesystem::path& path, Fnc&&) const {
|
void serialize(Ser& ser, const ghc::filesystem::path& path, Fnc&&) const {
|
||||||
auto path_str = path.string();
|
auto path_str = path.string();
|
||||||
ser.text1b(path_str, 4096);
|
ser.text1b(path_str, 4096);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Des, typename Fnc>
|
template <typename Des, typename Fnc>
|
||||||
void deserialize(Des& des, boost::filesystem::path& path, Fnc&&) const {
|
void deserialize(Des& des, ghc::filesystem::path& path, Fnc&&) const {
|
||||||
boost::filesystem::path::string_type path_str{};
|
ghc::filesystem::path::string_type path_str{};
|
||||||
des.text1b(path_str, 4096);
|
des.text1b(path_str, 4096);
|
||||||
path = path_str;
|
path = path_str;
|
||||||
}
|
}
|
||||||
@@ -52,7 +49,7 @@ class BoostPath {
|
|||||||
namespace traits {
|
namespace traits {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ExtensionTraits<ext::BoostPath, boost::filesystem::path> {
|
struct ExtensionTraits<ext::GhcPath, ghc::filesystem::path> {
|
||||||
using TValue = void;
|
using TValue = void;
|
||||||
static constexpr bool SupportValueOverload = false;
|
static constexpr bool SupportValueOverload = false;
|
||||||
static constexpr bool SupportObjectOverload = true;
|
static constexpr bool SupportObjectOverload = true;
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = ghc::filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for generating random identifiers.
|
* Used for generating random identifiers.
|
||||||
@@ -28,7 +28,7 @@ namespace fs = boost::filesystem;
|
|||||||
constexpr char alphanumeric_characters[] =
|
constexpr char alphanumeric_characters[] =
|
||||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
"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();
|
fs::path temp_directory = get_temporary_directory();
|
||||||
|
|
||||||
std::random_device random_device;
|
std::random_device random_device;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include <boost/asio/read.hpp>
|
#include <boost/asio/read.hpp>
|
||||||
#include <boost/asio/write.hpp>
|
#include <boost/asio/write.hpp>
|
||||||
#include <boost/container/small_vector.hpp>
|
#include <boost/container/small_vector.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <ghc/filesystem.hpp>
|
||||||
|
|
||||||
#include "../bitsery/traits/small-vector.h"
|
#include "../bitsery/traits/small-vector.h"
|
||||||
#include "../logging/common.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.
|
* @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.
|
* 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
|
* Manages all the sockets used for communicating between the plugin and the
|
||||||
@@ -287,7 +287,7 @@ class Sockets {
|
|||||||
*
|
*
|
||||||
* @see Sockets::connect
|
* @see Sockets::connect
|
||||||
*/
|
*/
|
||||||
Sockets(const boost::filesystem::path& endpoint_base_dir)
|
Sockets(const ghc::filesystem::path& endpoint_base_dir)
|
||||||
: base_dir_(endpoint_base_dir) {}
|
: base_dir_(endpoint_base_dir) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -305,9 +305,9 @@ class Sockets {
|
|||||||
// there's now a safeguard against that very thing. Hopefully
|
// there's now a safeguard against that very thing. Hopefully
|
||||||
// this should never be needed, but if it is, then I'm glad
|
// this should never be needed, but if it is, then I'm glad
|
||||||
// we'll have it!
|
// 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())) {
|
if (base_dir_.string().starts_with(temp_dir.string())) {
|
||||||
boost::filesystem::remove_all(base_dir_);
|
ghc::filesystem::remove_all(base_dir_);
|
||||||
} else {
|
} else {
|
||||||
Logger logger = Logger::create_exception_logger();
|
Logger logger = Logger::create_exception_logger();
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ class Sockets {
|
|||||||
"'");
|
"'");
|
||||||
logger.log("");
|
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
|
// There should not be any filesystem errors since only one side
|
||||||
// removes the files, but if we somehow can't delete the file
|
// removes the files, but if we somehow can't delete the file
|
||||||
// then we can just silently ignore this
|
// then we can just silently ignore this
|
||||||
@@ -351,7 +351,7 @@ class Sockets {
|
|||||||
* The base directory for our socket endpoints. All `*_endpoint` variables
|
* The base directory for our socket endpoints. All `*_endpoint` variables
|
||||||
* below are files within this directory.
|
* 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)
|
bool listen)
|
||||||
: endpoint_(endpoint), socket_(io_context) {
|
: endpoint_(endpoint), socket_(io_context) {
|
||||||
if (listen) {
|
if (listen) {
|
||||||
boost::filesystem::create_directories(
|
ghc::filesystem::create_directories(
|
||||||
boost::filesystem::path(endpoint.path()).parent_path());
|
ghc::filesystem::path(endpoint.path()).parent_path());
|
||||||
acceptor_.emplace(io_context, endpoint);
|
acceptor_.emplace(io_context, endpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -577,8 +577,8 @@ class AdHocSocketHandler {
|
|||||||
bool listen)
|
bool listen)
|
||||||
: io_context_(io_context), endpoint_(endpoint), socket_(io_context) {
|
: io_context_(io_context), endpoint_(endpoint), socket_(io_context) {
|
||||||
if (listen) {
|
if (listen) {
|
||||||
boost::filesystem::create_directories(
|
ghc::filesystem::create_directories(
|
||||||
boost::filesystem::path(endpoint.path()).parent_path());
|
ghc::filesystem::path(endpoint.path()).parent_path());
|
||||||
acceptor_.emplace(io_context, endpoint);
|
acceptor_.emplace(io_context, endpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -598,7 +598,7 @@ class AdHocSocketHandler {
|
|||||||
// potentially on the other side of the connection in the case
|
// potentially on the other side of the connection in the case
|
||||||
// where we're handling `vst_host_callback_` VST2 events
|
// where we're handling `vst_host_callback_` VST2 events
|
||||||
acceptor_.reset();
|
acceptor_.reset();
|
||||||
boost::filesystem::remove(endpoint_.path());
|
ghc::filesystem::remove(endpoint_.path());
|
||||||
} else {
|
} else {
|
||||||
socket_.connect(endpoint_);
|
socket_.connect(endpoint_);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ class Vst2Sockets final : public Sockets {
|
|||||||
* @see Vst2Sockets::connect
|
* @see Vst2Sockets::connect
|
||||||
*/
|
*/
|
||||||
Vst2Sockets(boost::asio::io_context& io_context,
|
Vst2Sockets(boost::asio::io_context& io_context,
|
||||||
const boost::filesystem::path& endpoint_base_dir,
|
const ghc::filesystem::path& endpoint_base_dir,
|
||||||
bool listen)
|
bool listen)
|
||||||
: Sockets(endpoint_base_dir),
|
: Sockets(endpoint_base_dir),
|
||||||
host_vst_dispatch_(io_context,
|
host_vst_dispatch_(io_context,
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ class Vst3Sockets final : public Sockets {
|
|||||||
* @see Vst3Sockets::connect
|
* @see Vst3Sockets::connect
|
||||||
*/
|
*/
|
||||||
Vst3Sockets(boost::asio::io_context& io_context,
|
Vst3Sockets(boost::asio::io_context& io_context,
|
||||||
const boost::filesystem::path& endpoint_base_dir,
|
const ghc::filesystem::path& endpoint_base_dir,
|
||||||
bool listen)
|
bool listen)
|
||||||
: Sockets(endpoint_base_dir),
|
: Sockets(endpoint_base_dir),
|
||||||
host_vst_control_(io_context,
|
host_vst_control_(io_context,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = ghc::filesystem;
|
||||||
|
|
||||||
Configuration::Configuration() noexcept {}
|
Configuration::Configuration() noexcept {}
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef __WINE__
|
|
||||||
#include "../wine-host/boost-fix.h"
|
|
||||||
#endif
|
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include "bitsery/ext/boost-path.h"
|
#include <ghc/filesystem.hpp>
|
||||||
|
|
||||||
|
#include "bitsery/ext/ghc-path.h"
|
||||||
#include "bitsery/ext/in-place-optional.h"
|
#include "bitsery/ext/in-place-optional.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,8 +68,8 @@ class Configuration {
|
|||||||
*
|
*
|
||||||
* @see ../plugin/utils.h:load_config_for
|
* @see ../plugin/utils.h:load_config_for
|
||||||
*/
|
*/
|
||||||
Configuration(const boost::filesystem::path& config_path,
|
Configuration(const ghc::filesystem::path& config_path,
|
||||||
const boost::filesystem::path& yabridge_path);
|
const ghc::filesystem::path& yabridge_path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the plugin group that should be used for the plugin this
|
* The name of the plugin group that should be used for the plugin this
|
||||||
@@ -92,7 +89,7 @@ class Configuration {
|
|||||||
* `<temporary_directory>/yabridge-plugin-output.log`, or it can be set to
|
* `<temporary_directory>/yabridge-plugin-output.log`, or it can be set to
|
||||||
* an absolute path. (we don't try to expand tildes)
|
* an absolute path. (we don't try to expand tildes)
|
||||||
*/
|
*/
|
||||||
std::optional<boost::filesystem::path> disable_pipes;
|
std::optional<ghc::filesystem::path> disable_pipes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this is set to `true`, then the after every resize we will move the
|
* If this is set to `true`, then the after every resize we will move the
|
||||||
@@ -167,7 +164,7 @@ class Configuration {
|
|||||||
/**
|
/**
|
||||||
* The path to the configuration file that was parsed.
|
* The path to the configuration file that was parsed.
|
||||||
*/
|
*/
|
||||||
std::optional<boost::filesystem::path> matched_file;
|
std::optional<ghc::filesystem::path> matched_file;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The matched glob pattern in the above configuration file.
|
* The matched glob pattern in the above configuration file.
|
||||||
@@ -199,7 +196,7 @@ class Configuration {
|
|||||||
[](S& s, auto& v) { s.text1b(v, 4096); });
|
[](S& s, auto& v) { s.text1b(v, 4096); });
|
||||||
|
|
||||||
s.ext(disable_pipes, bitsery::ext::InPlaceOptional(),
|
s.ext(disable_pipes, bitsery::ext::InPlaceOptional(),
|
||||||
[](S& s, auto& v) { s.ext(v, bitsery::ext::BoostPath{}); });
|
[](S& s, auto& v) { s.ext(v, bitsery::ext::GhcPath{}); });
|
||||||
s.value1b(editor_coordinate_hack);
|
s.value1b(editor_coordinate_hack);
|
||||||
s.value1b(editor_force_dnd);
|
s.value1b(editor_force_dnd);
|
||||||
s.value1b(editor_xembed);
|
s.value1b(editor_xembed);
|
||||||
@@ -210,7 +207,7 @@ class Configuration {
|
|||||||
s.value1b(vst3_prefer_32bit);
|
s.value1b(vst3_prefer_32bit);
|
||||||
|
|
||||||
s.ext(matched_file, bitsery::ext::InPlaceOptional(),
|
s.ext(matched_file, bitsery::ext::InPlaceOptional(),
|
||||||
[](S& s, auto& v) { s.ext(v, bitsery::ext::BoostPath{}); });
|
[](S& s, auto& v) { s.ext(v, bitsery::ext::GhcPath{}); });
|
||||||
s.ext(matched_pattern, bitsery::ext::InPlaceOptional(),
|
s.ext(matched_pattern, bitsery::ext::InPlaceOptional(),
|
||||||
[](S& s, auto& v) { s.text1b(v, 4096); });
|
[](S& s, auto& v) { s.text1b(v, 4096); });
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = ghc::filesystem;
|
||||||
|
|
||||||
LibArchitecture find_dll_architecture(const fs::path& plugin_path) {
|
LibArchitecture find_dll_architecture(const fs::path& plugin_path) {
|
||||||
std::ifstream file(plugin_path, std::ifstream::binary | std::ifstream::in);
|
std::ifstream file(plugin_path, std::ifstream::binary | std::ifstream::in);
|
||||||
|
|||||||
@@ -16,10 +16,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef __WINE__
|
#include <ghc/filesystem.hpp>
|
||||||
#include "../wine-host/boost-fix.h"
|
|
||||||
#endif
|
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
|
|
||||||
// Utilities and tags for plugin types and architectures
|
// Utilities and tags for plugin types and architectures
|
||||||
|
|
||||||
@@ -58,7 +55,7 @@ void serialize(S& s, PluginType& plugin_type) {
|
|||||||
* @return The detected architecture.
|
* @return The detected architecture.
|
||||||
* @throw std::runtime_error If the file is not a .dll file.
|
* @throw std::runtime_error If the file is not a .dll file.
|
||||||
*/
|
*/
|
||||||
LibArchitecture find_dll_architecture(const boost::filesystem::path&);
|
LibArchitecture find_dll_architecture(const ghc::filesystem::path&);
|
||||||
|
|
||||||
PluginType plugin_type_from_string(const std::string& plugin_type) noexcept;
|
PluginType plugin_type_from_string(const std::string& plugin_type) noexcept;
|
||||||
std::string plugin_type_to_string(const PluginType& plugin_type);
|
std::string plugin_type_to_string(const PluginType& plugin_type);
|
||||||
|
|||||||
+11
-12
@@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <xmmintrin.h>
|
#include <xmmintrin.h>
|
||||||
#include <boost/process/environment.hpp>
|
|
||||||
|
|
||||||
namespace bp = boost::process;
|
namespace fs = ghc::filesystem;
|
||||||
namespace fs = boost::filesystem;
|
|
||||||
|
|
||||||
using namespace std::literals::string_view_literals;
|
using namespace std::literals::string_view_literals;
|
||||||
|
|
||||||
@@ -40,13 +40,12 @@ constexpr char disable_watchdog_timer_env_var[] = "YABRIDGE_NO_WATCHDOG";
|
|||||||
constexpr char temp_dir_override_env_var[] = "YABRIDGE_TEMP_DIR";
|
constexpr char temp_dir_override_env_var[] = "YABRIDGE_TEMP_DIR";
|
||||||
|
|
||||||
fs::path get_temporary_directory() {
|
fs::path get_temporary_directory() {
|
||||||
const bp::environment env = boost::this_process::environment();
|
// NOLINTNEXTLINE(concurrency-mt-unsafe)
|
||||||
if (const auto directory = env.find(temp_dir_override_env_var);
|
if (const auto directory = getenv(temp_dir_override_env_var)) {
|
||||||
directory != env.end()) {
|
return fs::path(directory);
|
||||||
return directory->to_string();
|
// NOLINTNEXTLINE(concurrency-mt-unsafe)
|
||||||
} else if (const auto directory = env.find("XDG_RUNTIME_DIR");
|
} else if (const auto directory = getenv("XDG_RUNTIME_DIR")) {
|
||||||
directory != env.end()) {
|
return fs::path(directory);
|
||||||
return directory->to_string();
|
|
||||||
} else {
|
} else {
|
||||||
return fs::temp_directory_path();
|
return fs::temp_directory_path();
|
||||||
}
|
}
|
||||||
@@ -105,13 +104,13 @@ bool pid_running(pid_t pid) {
|
|||||||
// processes and zombies, and a terminated group host process will always be
|
// processes and zombies, and a terminated group host process will always be
|
||||||
// left as a zombie process. If the process is active, then
|
// left as a zombie process. If the process is active, then
|
||||||
// `/proc/<pid>/{cwd,exe,root}` will be valid symlinks.
|
// `/proc/<pid>/{cwd,exe,root}` will be valid symlinks.
|
||||||
boost::system::error_code err;
|
std::error_code err;
|
||||||
fs::canonical("/proc/" + std::to_string(pid) + "/exe", err);
|
fs::canonical("/proc/" + std::to_string(pid) + "/exe", err);
|
||||||
|
|
||||||
// NOTE: We can get a `EACCES` here if we don't have permissions to read
|
// NOTE: We can get a `EACCES` here if we don't have permissions to read
|
||||||
// this process's memory. This does mean that the process is still
|
// this process's memory. This does mean that the process is still
|
||||||
// running.
|
// running.
|
||||||
return !err.failed() || err.value() == EACCES;
|
return !err || err.value() == EACCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string url_encode_path(std::string path) {
|
std::string url_encode_path(std::string path) {
|
||||||
|
|||||||
+2
-6
@@ -19,11 +19,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
#include <ghc/filesystem.hpp>
|
||||||
#ifdef __WINE__
|
|
||||||
#include "../wine-host/boost-fix.h"
|
|
||||||
#endif
|
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interval in seconds between synchronizing the Wine plugin host's audio
|
* The interval in seconds between synchronizing the Wine plugin host's audio
|
||||||
@@ -79,7 +75,7 @@ overload(Ts...) -> overload<Ts...>;
|
|||||||
* Return the path to the directory for story temporary files. This will be
|
* Return the path to the directory for story temporary files. This will be
|
||||||
* `$XDG_RUNTIME_DIR` if set, and `/tmp` otherwise.
|
* `$XDG_RUNTIME_DIR` if set, and `/tmp` otherwise.
|
||||||
*/
|
*/
|
||||||
boost::filesystem::path get_temporary_directory();
|
ghc::filesystem::path get_temporary_directory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current thread's scheduling priority if the thread is using
|
* Get the current thread's scheduling priority if the thread is using
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ class PluginBridge {
|
|||||||
[&](const OverridenWinePrefix& prefix) {
|
[&](const OverridenWinePrefix& prefix) {
|
||||||
init_msg << prefix.value.string() << " <overridden>";
|
init_msg << prefix.value.string() << " <overridden>";
|
||||||
},
|
},
|
||||||
[&](const boost::filesystem::path& prefix) {
|
[&](const ghc::filesystem::path& prefix) {
|
||||||
init_msg << prefix.string();
|
init_msg << prefix.string();
|
||||||
},
|
},
|
||||||
[&](const DefaultWinePrefix&) { init_msg << "<default>"; },
|
[&](const DefaultWinePrefix&) { init_msg << "<default>"; },
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "../common/utils.h"
|
#include "../common/utils.h"
|
||||||
|
|
||||||
namespace bp = boost::process;
|
namespace bp = boost::process;
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = ghc::filesystem;
|
||||||
|
|
||||||
HostProcess::HostProcess(boost::asio::io_context& io_context,
|
HostProcess::HostProcess(boost::asio::io_context& io_context,
|
||||||
Logger& logger,
|
Logger& logger,
|
||||||
@@ -157,7 +157,8 @@ GroupHost::GroupHost(boost::asio::io_context& io_context,
|
|||||||
// because it should run independently of this yabridge instance as
|
// because it should run independently of this yabridge instance as
|
||||||
// it will likely outlive it.
|
// it will likely outlive it.
|
||||||
bp::child group_host =
|
bp::child group_host =
|
||||||
launch_host(host_path_, group_socket_path,
|
// FIXME: Boost.Filesystem conversion
|
||||||
|
launch_host(host_path_, group_socket_path.string(),
|
||||||
bp::env = plugin_info.create_host_env());
|
bp::env = plugin_info.create_host_env());
|
||||||
group_host.detach();
|
group_host.detach();
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
#include <boost/asio/local/stream_protocol.hpp>
|
#include <boost/asio/local/stream_protocol.hpp>
|
||||||
#include <boost/asio/streambuf.hpp>
|
#include <boost/asio/streambuf.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
#include <boost/process/child.hpp>
|
#include <boost/process/child.hpp>
|
||||||
#include <boost/process/extend.hpp>
|
#include <boost/process/extend.hpp>
|
||||||
#include <boost/process/io.hpp>
|
#include <boost/process/io.hpp>
|
||||||
|
#include <ghc/filesystem.hpp>
|
||||||
|
|
||||||
#include "../common/communication/common.h"
|
#include "../common/communication/common.h"
|
||||||
#include "../common/logging/common.h"
|
#include "../common/logging/common.h"
|
||||||
@@ -46,7 +46,7 @@ class HostProcess {
|
|||||||
* is chosen depending on the architecture of the plugin's DLL file and on
|
* is chosen depending on the architecture of the plugin's DLL file and on
|
||||||
* the hosting mode.
|
* the hosting mode.
|
||||||
*/
|
*/
|
||||||
virtual boost::filesystem::path path() = 0;
|
virtual ghc::filesystem::path path() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the host process is still running. Used during startup to
|
* Return true if the host process is still running. Used during startup to
|
||||||
@@ -69,7 +69,7 @@ class HostProcess {
|
|||||||
* multiple arugments.
|
* multiple arugments.
|
||||||
*/
|
*/
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
boost::process::child launch_host(boost::filesystem::path host_path,
|
boost::process::child launch_host(ghc::filesystem::path host_path,
|
||||||
Args&&... args) {
|
Args&&... args) {
|
||||||
return boost::process::child(
|
return boost::process::child(
|
||||||
#ifdef WITH_WINEDBG
|
#ifdef WITH_WINEDBG
|
||||||
@@ -88,7 +88,8 @@ class HostProcess {
|
|||||||
host_path.string() + ".so",
|
host_path.string() + ".so",
|
||||||
#endif // WINEDBG_LEGACY_ARGUMENT_QUOTING
|
#endif // WINEDBG_LEGACY_ARGUMENT_QUOTING
|
||||||
#else
|
#else
|
||||||
host_path,
|
// FIXME: Replace Boost.Filesystem
|
||||||
|
host_path.string(),
|
||||||
#endif // WITH_WINEDBG
|
#endif // WITH_WINEDBG
|
||||||
boost::process::std_out = stdout_pipe_,
|
boost::process::std_out = stdout_pipe_,
|
||||||
boost::process::std_err = stderr_pipe_,
|
boost::process::std_err = stderr_pipe_,
|
||||||
@@ -207,13 +208,13 @@ class IndividualHost : public HostProcess {
|
|||||||
const PluginInfo& plugin_info,
|
const PluginInfo& plugin_info,
|
||||||
const HostRequest& host_request);
|
const HostRequest& host_request);
|
||||||
|
|
||||||
boost::filesystem::path path() override;
|
ghc::filesystem::path path() override;
|
||||||
bool running() override;
|
bool running() override;
|
||||||
void terminate() override;
|
void terminate() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const PluginInfo& plugin_info_;
|
const PluginInfo& plugin_info_;
|
||||||
boost::filesystem::path host_path_;
|
ghc::filesystem::path host_path_;
|
||||||
boost::process::child host_;
|
boost::process::child host_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -255,13 +256,13 @@ class GroupHost : public HostProcess {
|
|||||||
const PluginInfo& plugin_info,
|
const PluginInfo& plugin_info,
|
||||||
const HostRequest& host_request);
|
const HostRequest& host_request);
|
||||||
|
|
||||||
boost::filesystem::path path() override;
|
ghc::filesystem::path path() override;
|
||||||
bool running() noexcept override;
|
bool running() noexcept override;
|
||||||
void terminate() override;
|
void terminate() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const PluginInfo& plugin_info_;
|
const PluginInfo& plugin_info_;
|
||||||
boost::filesystem::path host_path_;
|
ghc::filesystem::path host_path_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We want to either connect to an existing group host process, or spawn a
|
* We want to either connect to an existing group host process, or spawn a
|
||||||
|
|||||||
+23
-15
@@ -38,7 +38,7 @@
|
|||||||
#include "../common/utils.h"
|
#include "../common/utils.h"
|
||||||
|
|
||||||
namespace bp = boost::process;
|
namespace bp = boost::process;
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = ghc::filesystem;
|
||||||
|
|
||||||
// These functions are used to populate the fields in `PluginInfo`. See the
|
// These functions are used to populate the fields in `PluginInfo`. See the
|
||||||
// docstrings for the corresponding fields for more information on what we're
|
// docstrings for the corresponding fields for more information on what we're
|
||||||
@@ -74,7 +74,7 @@ bp::environment PluginInfo::create_host_env() const {
|
|||||||
// just for clarity's sake)
|
// just for clarity's sake)
|
||||||
std::visit(overload{
|
std::visit(overload{
|
||||||
[](const OverridenWinePrefix&) {},
|
[](const OverridenWinePrefix&) {},
|
||||||
[&](const boost::filesystem::path& prefix) {
|
[&](const ghc::filesystem::path& prefix) {
|
||||||
env["WINEPREFIX"] = prefix.string();
|
env["WINEPREFIX"] = prefix.string();
|
||||||
},
|
},
|
||||||
[](const DefaultWinePrefix&) {},
|
[](const DefaultWinePrefix&) {},
|
||||||
@@ -84,11 +84,11 @@ bp::environment PluginInfo::create_host_env() const {
|
|||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path PluginInfo::normalize_wine_prefix() const {
|
ghc::filesystem::path PluginInfo::normalize_wine_prefix() const {
|
||||||
return std::visit(
|
return std::visit(
|
||||||
overload{
|
overload{
|
||||||
[](const OverridenWinePrefix& prefix) { return prefix.value; },
|
[](const OverridenWinePrefix& prefix) { return prefix.value; },
|
||||||
[](const boost::filesystem::path& prefix) { return prefix; },
|
[](const ghc::filesystem::path& prefix) { return prefix; },
|
||||||
[](const DefaultWinePrefix&) {
|
[](const DefaultWinePrefix&) {
|
||||||
const bp::environment env = boost::this_process::environment();
|
const bp::environment env = boost::this_process::environment();
|
||||||
return fs::path(env.at("HOME").to_string()) / ".wine";
|
return fs::path(env.at("HOME").to_string()) / ".wine";
|
||||||
@@ -101,7 +101,8 @@ std::string PluginInfo::wine_version() const {
|
|||||||
// The '*.exe' scripts generated by winegcc allow you to override the binary
|
// The '*.exe' scripts generated by winegcc allow you to override the binary
|
||||||
// used to run Wine, so will will handle this in the same way for our Wine
|
// used to run Wine, so will will handle this in the same way for our Wine
|
||||||
// version detection
|
// version detection
|
||||||
fs::path wine_path;
|
// FIXME: Replace Boost.Filesystem usage
|
||||||
|
boost::filesystem::path wine_path;
|
||||||
bp::environment env = create_host_env();
|
bp::environment env = create_host_env();
|
||||||
if (const std::string wineloader_path = env["WINELOADER"].to_string();
|
if (const std::string wineloader_path = env["WINELOADER"].to_string();
|
||||||
access(wineloader_path.c_str(), X_OK) == 0) {
|
access(wineloader_path.c_str(), X_OK) == 0) {
|
||||||
@@ -280,7 +281,8 @@ fs::path get_this_file_location() {
|
|||||||
// way to work around this if this happens is to just add another
|
// way to work around this if this happens is to just add another
|
||||||
// leading slash and then normalize the path, since three or more
|
// leading slash and then normalize the path, since three or more
|
||||||
// slashes will be coerced into a single slash.
|
// slashes will be coerced into a single slash.
|
||||||
fs::path this_file = boost::dll::this_line_location();
|
// FIXME: Replace Boost.Filesystem usage
|
||||||
|
fs::path this_file = boost::dll::this_line_location().string();
|
||||||
if (this_file.string().starts_with("//")) {
|
if (this_file.string().starts_with("//")) {
|
||||||
this_file = ("/" / this_file).lexically_normal();
|
this_file = ("/" / this_file).lexically_normal();
|
||||||
}
|
}
|
||||||
@@ -318,9 +320,10 @@ std::string create_logger_prefix(const fs::path& endpoint_base_dir) {
|
|||||||
return "[" + endpoint_name + "] ";
|
return "[" + endpoint_name + "] ";
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::path find_vst_host(const boost::filesystem::path& this_plugin_path,
|
fs::path find_vst_host(const ghc::filesystem::path& this_plugin_path,
|
||||||
LibArchitecture plugin_arch,
|
LibArchitecture plugin_arch,
|
||||||
bool use_plugin_groups) {
|
bool use_plugin_groups) {
|
||||||
|
// FIXME: Anything using `this_plugin_path` and similar needs to be changed
|
||||||
auto host_name = use_plugin_groups ? yabridge_group_host_name
|
auto host_name = use_plugin_groups ? yabridge_group_host_name
|
||||||
: yabridge_individual_host_name;
|
: yabridge_individual_host_name;
|
||||||
if (plugin_arch == LibArchitecture::dll_32) {
|
if (plugin_arch == LibArchitecture::dll_32) {
|
||||||
@@ -338,19 +341,20 @@ fs::path find_vst_host(const boost::filesystem::path& this_plugin_path,
|
|||||||
|
|
||||||
// Boost will return an empty path if the file could not be found in the
|
// Boost will return an empty path if the file could not be found in the
|
||||||
// search path
|
// search path
|
||||||
const fs::path vst_host_path =
|
const boost::filesystem::path vst_host_path =
|
||||||
bp::search_path(host_name, get_augmented_search_path());
|
bp::search_path(host_name, get_augmented_search_path());
|
||||||
if (vst_host_path == "") {
|
if (vst_host_path == "") {
|
||||||
throw std::runtime_error("Could not locate '" + std::string(host_name) +
|
throw std::runtime_error("Could not locate '" + std::string(host_name) +
|
||||||
"'");
|
"'");
|
||||||
}
|
}
|
||||||
|
|
||||||
return vst_host_path;
|
// FIXME: Replace Boost.Filesystem usage requiring this conversion
|
||||||
|
return vst_host_path.string();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path generate_group_endpoint(
|
ghc::filesystem::path generate_group_endpoint(
|
||||||
const std::string& group_name,
|
const std::string& group_name,
|
||||||
const boost::filesystem::path& wine_prefix,
|
const ghc::filesystem::path& wine_prefix,
|
||||||
const LibArchitecture architecture) {
|
const LibArchitecture architecture) {
|
||||||
std::ostringstream socket_name;
|
std::ostringstream socket_name;
|
||||||
socket_name << "yabridge-group-" << group_name << "-"
|
socket_name << "yabridge-group-" << group_name << "-"
|
||||||
@@ -370,6 +374,7 @@ boost::filesystem::path generate_group_endpoint(
|
|||||||
return get_temporary_directory() / socket_name.str();
|
return get_temporary_directory() / socket_name.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Replace Boost.Filesystem
|
||||||
std::vector<boost::filesystem::path> get_augmented_search_path() {
|
std::vector<boost::filesystem::path> get_augmented_search_path() {
|
||||||
// HACK: `std::locale("")` would return the current locale, but this
|
// HACK: `std::locale("")` would return the current locale, but this
|
||||||
// overload is implementation specific, and libstdc++ returns an error
|
// overload is implementation specific, and libstdc++ returns an error
|
||||||
@@ -410,11 +415,12 @@ std::vector<boost::filesystem::path> get_augmented_search_path() {
|
|||||||
const bp::environment environment = boost::this_process::environment();
|
const bp::environment environment = boost::this_process::environment();
|
||||||
if (auto xdg_data_home = environment.find("XDG_DATA_HOME");
|
if (auto xdg_data_home = environment.find("XDG_DATA_HOME");
|
||||||
xdg_data_home != environment.end()) {
|
xdg_data_home != environment.end()) {
|
||||||
search_path.push_back(fs::path(xdg_data_home->to_string()) /
|
search_path.push_back(
|
||||||
"yabridge");
|
boost::filesystem::path(xdg_data_home->to_string()) / "yabridge");
|
||||||
} else if (auto home_directory = environment.find("HOME");
|
} else if (auto home_directory = environment.find("HOME");
|
||||||
home_directory != environment.end()) {
|
home_directory != environment.end()) {
|
||||||
search_path.push_back(fs::path(home_directory->to_string()) / ".local" /
|
search_path.push_back(
|
||||||
|
boost::filesystem::path(home_directory->to_string()) / ".local" /
|
||||||
"share" / "yabridge");
|
"share" / "yabridge");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +442,9 @@ Configuration load_config_for(const fs::path& yabridge_path) {
|
|||||||
bool send_notification(const std::string& title,
|
bool send_notification(const std::string& title,
|
||||||
const std::string body,
|
const std::string body,
|
||||||
bool append_origin) {
|
bool append_origin) {
|
||||||
const fs::path notify_send_path = bp::search_path("notify-send");
|
// FIXME: Replace Boost.Filesystem
|
||||||
|
const boost::filesystem::path notify_send_path =
|
||||||
|
bp::search_path("notify-send");
|
||||||
if (notify_send_path.empty()) {
|
if (notify_send_path.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-19
@@ -34,7 +34,7 @@ struct DefaultWinePrefix {};
|
|||||||
* environment variable.
|
* environment variable.
|
||||||
*/
|
*/
|
||||||
struct OverridenWinePrefix {
|
struct OverridenWinePrefix {
|
||||||
boost::filesystem::path value;
|
ghc::filesystem::path value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +81,7 @@ struct PluginInfo {
|
|||||||
* Return the path to the actual Wine prefix in use, taking into account
|
* Return the path to the actual Wine prefix in use, taking into account
|
||||||
* `WINEPREFIX` overrides and the default `~/.wine` fallback.
|
* `WINEPREFIX` overrides and the default `~/.wine` fallback.
|
||||||
*/
|
*/
|
||||||
boost::filesystem::path normalize_wine_prefix() const;
|
ghc::filesystem::path normalize_wine_prefix() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the installed Wine version. This is obtained by from `wine
|
* Return the installed Wine version. This is obtained by from `wine
|
||||||
@@ -103,7 +103,7 @@ struct PluginInfo {
|
|||||||
* module (since that has to be bundle on Linux) but rather the .so file
|
* module (since that has to be bundle on Linux) but rather the .so file
|
||||||
* contained in that bundle.
|
* contained in that bundle.
|
||||||
*/
|
*/
|
||||||
const boost::filesystem::path native_library_path_;
|
const ghc::filesystem::path native_library_path_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@@ -113,7 +113,7 @@ struct PluginInfo {
|
|||||||
* instead. We store this intermediate value so we can determine the
|
* instead. We store this intermediate value so we can determine the
|
||||||
* plugin's architecture.
|
* plugin's architecture.
|
||||||
*/
|
*/
|
||||||
const boost::filesystem::path windows_library_path_;
|
const ghc::filesystem::path windows_library_path_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const LibArchitecture plugin_arch_;
|
const LibArchitecture plugin_arch_;
|
||||||
@@ -132,7 +132,7 @@ struct PluginInfo {
|
|||||||
*
|
*
|
||||||
* https://developer.steinberg.help/pages/viewpage.action?pageId=9798275
|
* https://developer.steinberg.help/pages/viewpage.action?pageId=9798275
|
||||||
*/
|
*/
|
||||||
const boost::filesystem::path windows_plugin_path_;
|
const ghc::filesystem::path windows_plugin_path_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Wine prefix to use for hosting `windows_plugin_path_`. If the
|
* The Wine prefix to use for hosting `windows_plugin_path_`. If the
|
||||||
@@ -144,7 +144,7 @@ struct PluginInfo {
|
|||||||
* prefix will be used instead.
|
* prefix will be used instead.
|
||||||
*/
|
*/
|
||||||
const std::
|
const std::
|
||||||
variant<OverridenWinePrefix, boost::filesystem::path, DefaultWinePrefix>
|
variant<OverridenWinePrefix, ghc::filesystem::path, DefaultWinePrefix>
|
||||||
wine_prefix_;
|
wine_prefix_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ std::string join_quoted_strings(std::vector<std::string>& strings);
|
|||||||
* @return A prefix string for log messages.
|
* @return A prefix string for log messages.
|
||||||
*/
|
*/
|
||||||
std::string create_logger_prefix(
|
std::string create_logger_prefix(
|
||||||
const boost::filesystem::path& endpoint_base_dir);
|
const ghc::filesystem::path& endpoint_base_dir);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the Wine VST host (either `yabridge-host.exe` or `yabridge-host.exe`
|
* Finds the Wine VST host (either `yabridge-host.exe` or `yabridge-host.exe`
|
||||||
@@ -197,8 +197,8 @@ std::string create_logger_prefix(
|
|||||||
* @return The a path to the VST host, if found.
|
* @return The a path to the VST host, if found.
|
||||||
* @throw std::runtime_error If the Wine VST host could not be found.
|
* @throw std::runtime_error If the Wine VST host could not be found.
|
||||||
*/
|
*/
|
||||||
boost::filesystem::path find_vst_host(
|
ghc::filesystem::path find_vst_host(
|
||||||
const boost::filesystem::path& this_plugin_path,
|
const ghc::filesystem::path& this_plugin_path,
|
||||||
LibArchitecture plugin_arch,
|
LibArchitecture plugin_arch,
|
||||||
bool use_plugin_groups);
|
bool use_plugin_groups);
|
||||||
|
|
||||||
@@ -220,9 +220,9 @@ boost::filesystem::path find_vst_host(
|
|||||||
* @return A socket endpoint path that corresponds to the format described
|
* @return A socket endpoint path that corresponds to the format described
|
||||||
* above.
|
* above.
|
||||||
*/
|
*/
|
||||||
boost::filesystem::path generate_group_endpoint(
|
ghc::filesystem::path generate_group_endpoint(
|
||||||
const std::string& group_name,
|
const std::string& group_name,
|
||||||
const boost::filesystem::path& wine_prefix,
|
const ghc::filesystem::path& wine_prefix,
|
||||||
const LibArchitecture architecture);
|
const LibArchitecture architecture);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,6 +233,8 @@ boost::filesystem::path generate_group_endpoint(
|
|||||||
* environment variable can be a big hurdle if you've never done anything like
|
* environment variable can be a big hurdle if you've never done anything like
|
||||||
* that before. And since this is the recommended installation location, it
|
* that before. And since this is the recommended installation location, it
|
||||||
* makes sense to also search there by default.
|
* makes sense to also search there by default.
|
||||||
|
*
|
||||||
|
* FIXME: Replace Boost.Filesystem
|
||||||
*/
|
*/
|
||||||
std::vector<boost::filesystem::path> get_augmented_search_path();
|
std::vector<boost::filesystem::path> get_augmented_search_path();
|
||||||
|
|
||||||
@@ -240,7 +242,7 @@ std::vector<boost::filesystem::path> get_augmented_search_path();
|
|||||||
* Return a path to this `.so` file. This can be used to find out from where
|
* Return a path to this `.so` file. This can be used to find out from where
|
||||||
* this link to or copy of `libyabridge-{vst2,vst3}.so` was loaded.
|
* this link to or copy of `libyabridge-{vst2,vst3}.so` was loaded.
|
||||||
*/
|
*/
|
||||||
boost::filesystem::path get_this_file_location();
|
ghc::filesystem::path get_this_file_location();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the configuration that belongs to a copy of or symlink to
|
* Load the configuration that belongs to a copy of or symlink to
|
||||||
@@ -263,7 +265,7 @@ boost::filesystem::path get_this_file_location();
|
|||||||
*
|
*
|
||||||
* @see Configuration
|
* @see Configuration
|
||||||
*/
|
*/
|
||||||
Configuration load_config_for(const boost::filesystem::path& yabridge_path);
|
Configuration load_config_for(const ghc::filesystem::path& yabridge_path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a desktop notification using `notify-send`. Used for diagnostics when a
|
* Send a desktop notification using `notify-send`. Used for diagnostics when a
|
||||||
@@ -299,14 +301,14 @@ bool send_notification(const std::string& title,
|
|||||||
* @return The path to the *file* found, or `std::nullopt` if the file could not
|
* @return The path to the *file* found, or `std::nullopt` if the file could not
|
||||||
* be found.
|
* be found.
|
||||||
*/
|
*/
|
||||||
template <invocable_returning<bool, const boost::filesystem::path&> F =
|
template <invocable_returning<bool, const ghc::filesystem::path&> F =
|
||||||
bool(const boost::filesystem::path&)>
|
bool(const ghc::filesystem::path&)>
|
||||||
std::optional<boost::filesystem::path> find_dominating_file(
|
std::optional<ghc::filesystem::path> find_dominating_file(
|
||||||
const std::string& filename,
|
const std::string& filename,
|
||||||
boost::filesystem::path starting_dir,
|
ghc::filesystem::path starting_dir,
|
||||||
F&& predicate = boost::filesystem::exists) {
|
F&& predicate = ghc::filesystem::exists) {
|
||||||
while (starting_dir != "") {
|
while (starting_dir != "") {
|
||||||
const boost::filesystem::path candidate = starting_dir / filename;
|
const ghc::filesystem::path candidate = starting_dir / filename;
|
||||||
if (predicate(candidate)) {
|
if (predicate(candidate)) {
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ constexpr int extended_max_win32_messages = 8192;
|
|||||||
constexpr unsigned int juce_message_id = WM_USER + 123;
|
constexpr unsigned int juce_message_id = WM_USER + 123;
|
||||||
|
|
||||||
HostBridge::HostBridge(MainContext& main_context,
|
HostBridge::HostBridge(MainContext& main_context,
|
||||||
boost::filesystem::path plugin_path,
|
ghc::filesystem::path plugin_path,
|
||||||
pid_t parent_pid)
|
pid_t parent_pid)
|
||||||
: plugin_path_(plugin_path),
|
: plugin_path_(plugin_path),
|
||||||
main_context_(main_context),
|
main_context_(main_context),
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "../boost-fix.h"
|
#include "../boost-fix.h"
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <ghc/filesystem.hpp>
|
||||||
|
|
||||||
#include "../../common/logging/common.h"
|
#include "../../common/logging/common.h"
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
class HostBridge {
|
class HostBridge {
|
||||||
protected:
|
protected:
|
||||||
HostBridge(MainContext& main_context,
|
HostBridge(MainContext& main_context,
|
||||||
boost::filesystem::path plugin_path,
|
ghc::filesystem::path plugin_path,
|
||||||
pid_t parent_pid);
|
pid_t parent_pid);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -98,7 +98,7 @@ class HostBridge {
|
|||||||
/**
|
/**
|
||||||
* The path to the .dll being loaded in the Wine plugin host.
|
* The path to the .dll being loaded in the Wine plugin host.
|
||||||
*/
|
*/
|
||||||
const boost::filesystem::path plugin_path_;
|
const ghc::filesystem::path plugin_path_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "../boost-fix.h"
|
#include "../boost-fix.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <boost/process/environment.hpp>
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
#include "../../common/communication/common.h"
|
#include "../../common/communication/common.h"
|
||||||
@@ -30,7 +29,7 @@
|
|||||||
|
|
||||||
// FIXME: `std::filesystem` is broken in wineg++, at least under Wine 5.8. Any
|
// FIXME: `std::filesystem` is broken in wineg++, at least under Wine 5.8. Any
|
||||||
// path operation will thrown an encoding related error
|
// path operation will thrown an encoding related error
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = ghc::filesystem;
|
||||||
|
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
|
|
||||||
@@ -86,7 +85,7 @@ StdIoCapture::~StdIoCapture() noexcept {
|
|||||||
close(pipe_fd_[0]);
|
close(pipe_fd_[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupBridge::GroupBridge(boost::filesystem::path group_socket_path)
|
GroupBridge::GroupBridge(ghc::filesystem::path group_socket_path)
|
||||||
: logger_(Logger::create_from_environment(
|
: logger_(Logger::create_from_environment(
|
||||||
create_logger_prefix(group_socket_path))),
|
create_logger_prefix(group_socket_path))),
|
||||||
main_context_(),
|
main_context_(),
|
||||||
@@ -191,7 +190,7 @@ void GroupBridge::accept_requests() {
|
|||||||
// this process to crash during its initialization to prevent
|
// this process to crash during its initialization to prevent
|
||||||
// waiting indefinitely on the sockets to be connected to.
|
// waiting indefinitely on the sockets to be connected to.
|
||||||
const auto request = read_object<HostRequest>(socket);
|
const auto request = read_object<HostRequest>(socket);
|
||||||
write_object(socket, HostResponse{boost::this_process::get_id()});
|
write_object(socket, HostResponse{.pid = getpid()});
|
||||||
|
|
||||||
// The plugin has to be initiated on the IO context's thread because
|
// The plugin has to be initiated on the IO context's thread because
|
||||||
// this has to be done on the same thread that's handling messages,
|
// this has to be done on the same thread that's handling messages,
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class GroupBridge {
|
|||||||
* STDOUT and STDERR streams of the current process will be redirected to
|
* STDOUT and STDERR streams of the current process will be redirected to
|
||||||
* a pipe so they can be properly written to a log file.
|
* a pipe so they can be properly written to a log file.
|
||||||
*/
|
*/
|
||||||
explicit GroupBridge(boost::filesystem::path group_socket_path);
|
explicit GroupBridge(ghc::filesystem::path group_socket_path);
|
||||||
|
|
||||||
~GroupBridge() noexcept;
|
~GroupBridge() noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ if is_64bit_system
|
|||||||
configuration_dep,
|
configuration_dep,
|
||||||
|
|
||||||
boost_dep,
|
boost_dep,
|
||||||
boost_filesystem_64bit_dep,
|
|
||||||
bitsery_dep,
|
bitsery_dep,
|
||||||
function2_dep,
|
function2_dep,
|
||||||
|
ghc_filesystem_dep,
|
||||||
rt_dep,
|
rt_dep,
|
||||||
tomlplusplus_dep,
|
tomlplusplus_dep,
|
||||||
wine_ole32_dep,
|
wine_ole32_dep,
|
||||||
@@ -36,7 +36,7 @@ if with_bitbridge
|
|||||||
configuration_dep,
|
configuration_dep,
|
||||||
|
|
||||||
boost_dep,
|
boost_dep,
|
||||||
boost_filesystem_32bit_dep,
|
ghc_filesystem_dep,
|
||||||
bitsery_dep,
|
bitsery_dep,
|
||||||
function2_dep,
|
function2_dep,
|
||||||
rt_dep,
|
rt_dep,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = ghc::filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The window class name Wine uses for its `DoDragDrop()` tracker window.
|
* The window class name Wine uses for its `DoDragDrop()` tracker window.
|
||||||
@@ -193,7 +193,7 @@ WineXdndProxy::Handle WineXdndProxy::get_handle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WineXdndProxy::begin_xdnd(const boost::container::small_vector_base<
|
void WineXdndProxy::begin_xdnd(const boost::container::small_vector_base<
|
||||||
boost::filesystem::path>& file_paths,
|
ghc::filesystem::path>& file_paths,
|
||||||
HWND tracker_window) {
|
HWND tracker_window) {
|
||||||
if (file_paths.empty()) {
|
if (file_paths.empty()) {
|
||||||
throw std::runtime_error("Cannot drag-and-drop without any files");
|
throw std::runtime_error("Cannot drag-and-drop without any files");
|
||||||
@@ -243,8 +243,8 @@ void WineXdndProxy::begin_xdnd(const boost::container::small_vector_base<
|
|||||||
[](size_t size, const auto& path) {
|
[](size_t size, const auto& path) {
|
||||||
// Account for the protocol, the trailing line feed, and URL
|
// Account for the protocol, the trailing line feed, and URL
|
||||||
// encoding
|
// encoding
|
||||||
return size +
|
return size + static_cast<size_t>(
|
||||||
static_cast<size_t>(static_cast<double>(path.size()) * 1.2);
|
static_cast<double>(path.native().size()) * 1.2);
|
||||||
}));
|
}));
|
||||||
for (const auto& path : file_paths) {
|
for (const auto& path : file_paths) {
|
||||||
dragged_files_uri_list_.append(file_protocol);
|
dragged_files_uri_list_.append(file_protocol);
|
||||||
@@ -849,9 +849,9 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
|
|||||||
const char* unix_path =
|
const char* unix_path =
|
||||||
wine_get_unix_file_name(file_name.data());
|
wine_get_unix_file_name(file_name.data());
|
||||||
if (unix_path) {
|
if (unix_path) {
|
||||||
boost::system::error_code err;
|
std::error_code err;
|
||||||
const fs::path cannonical_path =
|
const fs::path cannonical_path =
|
||||||
boost::filesystem::canonical(unix_path,
|
ghc::filesystem::canonical(unix_path,
|
||||||
err);
|
err);
|
||||||
if (err) {
|
if (err) {
|
||||||
dragged_files.emplace_back(unix_path);
|
dragged_files.emplace_back(unix_path);
|
||||||
@@ -875,9 +875,9 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
|
|||||||
const char* unix_path =
|
const char* unix_path =
|
||||||
wine_get_unix_file_name(storage.lpszFileName);
|
wine_get_unix_file_name(storage.lpszFileName);
|
||||||
if (unix_path) {
|
if (unix_path) {
|
||||||
boost::system::error_code err;
|
std::error_code err;
|
||||||
const fs::path cannonical_path =
|
const fs::path cannonical_path =
|
||||||
boost::filesystem::canonical(unix_path, err);
|
ghc::filesystem::canonical(unix_path, err);
|
||||||
if (err) {
|
if (err) {
|
||||||
dragged_files.emplace_back(unix_path);
|
dragged_files.emplace_back(unix_path);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <boost/container/small_vector.hpp>
|
#include <boost/container/small_vector.hpp>
|
||||||
|
#include <ghc/filesystem.hpp>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
@@ -149,7 +150,7 @@ class WineXdndProxy {
|
|||||||
* selection and setting up the event listeners.
|
* selection and setting up the event listeners.
|
||||||
*/
|
*/
|
||||||
void begin_xdnd(const boost::container::small_vector_base<
|
void begin_xdnd(const boost::container::small_vector_base<
|
||||||
boost::filesystem::path>& file_paths,
|
ghc::filesystem::path>& file_paths,
|
||||||
HWND tracker_window);
|
HWND tracker_window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -68,10 +68,9 @@ replace_char16 "using Converter = std::wstring_convert<std::codecvt_utf8_utf16<c
|
|||||||
sed -i 's/\bgeneric_u8string\b/generic_string/g' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
|
sed -i 's/\bgeneric_u8string\b/generic_string/g' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
|
||||||
|
|
||||||
# libstdc++fs doesn't work under Winelib, for whatever reason that might be.
|
# libstdc++fs doesn't work under Winelib, for whatever reason that might be.
|
||||||
# We'll patch the Win32 module loading to use Boost.Filesystem instead.
|
# We'll patch the Win32 module loading to use `ghc::filesystem` instead.
|
||||||
sed -i 's/^#include <\(experimental\/\)\?filesystem>$/#include <boost\/filesystem.hpp>/' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
|
sed -i 's/^#include <\(experimental\/\)\?filesystem>$/#include <ghc\/filesystem.hpp>/' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
|
||||||
sed -i 's/^namespace filesystem = std\(::experimental\)\?::filesystem;$/namespace filesystem = boost::filesystem;/' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
|
sed -i 's/^namespace filesystem = std\(::experimental\)\?::filesystem;$/namespace filesystem = ghc::filesystem;/' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
|
||||||
sed -i 's/\bfile_type::directory\b/file_type::directory_file/g' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp"
|
|
||||||
|
|
||||||
# Wine uses the narrow versions of everything by default, and in Unity builds
|
# Wine uses the narrow versions of everything by default, and in Unity builds
|
||||||
# we need to explicitly use the UTF-16 version here.
|
# we need to explicitly use the UTF-16 version here.
|
||||||
|
|||||||
Reference in New Issue
Block a user