mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-15 04:50:43 +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:
@@ -48,7 +48,7 @@ constexpr int extended_max_win32_messages = 8192;
|
||||
constexpr unsigned int juce_message_id = WM_USER + 123;
|
||||
|
||||
HostBridge::HostBridge(MainContext& main_context,
|
||||
boost::filesystem::path plugin_path,
|
||||
ghc::filesystem::path plugin_path,
|
||||
pid_t parent_pid)
|
||||
: plugin_path_(plugin_path),
|
||||
main_context_(main_context),
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "../boost-fix.h"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <ghc/filesystem.hpp>
|
||||
|
||||
#include "../../common/logging/common.h"
|
||||
#include "../utils.h"
|
||||
@@ -33,7 +33,7 @@
|
||||
class HostBridge {
|
||||
protected:
|
||||
HostBridge(MainContext& main_context,
|
||||
boost::filesystem::path plugin_path,
|
||||
ghc::filesystem::path plugin_path,
|
||||
pid_t parent_pid);
|
||||
|
||||
public:
|
||||
@@ -98,7 +98,7 @@ class HostBridge {
|
||||
/**
|
||||
* 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:
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "../boost-fix.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <boost/process/environment.hpp>
|
||||
#include <regex>
|
||||
|
||||
#include "../../common/communication/common.h"
|
||||
@@ -30,7 +29,7 @@
|
||||
|
||||
// FIXME: `std::filesystem` is broken in wineg++, at least under Wine 5.8. Any
|
||||
// path operation will thrown an encoding related error
|
||||
namespace fs = boost::filesystem;
|
||||
namespace fs = ghc::filesystem;
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
@@ -86,7 +85,7 @@ StdIoCapture::~StdIoCapture() noexcept {
|
||||
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(
|
||||
create_logger_prefix(group_socket_path))),
|
||||
main_context_(),
|
||||
@@ -191,7 +190,7 @@ void GroupBridge::accept_requests() {
|
||||
// this process to crash during its initialization to prevent
|
||||
// waiting indefinitely on the sockets to be connected to.
|
||||
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
|
||||
// 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ if is_64bit_system
|
||||
configuration_dep,
|
||||
|
||||
boost_dep,
|
||||
boost_filesystem_64bit_dep,
|
||||
bitsery_dep,
|
||||
function2_dep,
|
||||
ghc_filesystem_dep,
|
||||
rt_dep,
|
||||
tomlplusplus_dep,
|
||||
wine_ole32_dep,
|
||||
@@ -36,7 +36,7 @@ if with_bitbridge
|
||||
configuration_dep,
|
||||
|
||||
boost_dep,
|
||||
boost_filesystem_32bit_dep,
|
||||
ghc_filesystem_dep,
|
||||
bitsery_dep,
|
||||
function2_dep,
|
||||
rt_dep,
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
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.
|
||||
@@ -193,7 +193,7 @@ WineXdndProxy::Handle WineXdndProxy::get_handle() {
|
||||
}
|
||||
|
||||
void WineXdndProxy::begin_xdnd(const boost::container::small_vector_base<
|
||||
boost::filesystem::path>& file_paths,
|
||||
ghc::filesystem::path>& file_paths,
|
||||
HWND tracker_window) {
|
||||
if (file_paths.empty()) {
|
||||
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) {
|
||||
// Account for the protocol, the trailing line feed, and URL
|
||||
// encoding
|
||||
return size +
|
||||
static_cast<size_t>(static_cast<double>(path.size()) * 1.2);
|
||||
return size + static_cast<size_t>(
|
||||
static_cast<double>(path.native().size()) * 1.2);
|
||||
}));
|
||||
for (const auto& path : file_paths) {
|
||||
dragged_files_uri_list_.append(file_protocol);
|
||||
@@ -849,10 +849,10 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
|
||||
const char* unix_path =
|
||||
wine_get_unix_file_name(file_name.data());
|
||||
if (unix_path) {
|
||||
boost::system::error_code err;
|
||||
std::error_code err;
|
||||
const fs::path cannonical_path =
|
||||
boost::filesystem::canonical(unix_path,
|
||||
err);
|
||||
ghc::filesystem::canonical(unix_path,
|
||||
err);
|
||||
if (err) {
|
||||
dragged_files.emplace_back(unix_path);
|
||||
} else {
|
||||
@@ -875,9 +875,9 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
|
||||
const char* unix_path =
|
||||
wine_get_unix_file_name(storage.lpszFileName);
|
||||
if (unix_path) {
|
||||
boost::system::error_code err;
|
||||
std::error_code err;
|
||||
const fs::path cannonical_path =
|
||||
boost::filesystem::canonical(unix_path, err);
|
||||
ghc::filesystem::canonical(unix_path, err);
|
||||
if (err) {
|
||||
dragged_files.emplace_back(unix_path);
|
||||
} else {
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
#include <ghc/filesystem.hpp>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
@@ -149,7 +150,7 @@ class WineXdndProxy {
|
||||
* selection and setting up the event listeners.
|
||||
*/
|
||||
void begin_xdnd(const boost::container::small_vector_base<
|
||||
boost::filesystem::path>& file_paths,
|
||||
ghc::filesystem::path>& file_paths,
|
||||
HWND tracker_window);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user