mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-20 11:02:52 +02:00
Use Boost.Filesystem for the configuration
I'd much rather just use std::filesystem, but since all of Boost.Process, Boost.DLL Boost.Asio uses its own filesystem library we need to use it anyways.
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <filesystem>
|
#include <boost/filesystem.hpp>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,13 +34,13 @@
|
|||||||
* @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 <typename F = bool(const std::filesystem::path&)>
|
template <typename F = bool(const boost::filesystem::path&)>
|
||||||
std::optional<std::filesystem::path> find_dominating_file(
|
std::optional<boost::filesystem::path> find_dominating_file(
|
||||||
const std::string& filename,
|
const std::string& filename,
|
||||||
std::filesystem::path starting_dir,
|
boost::filesystem::path starting_dir,
|
||||||
F predicate = std::filesystem::exists) {
|
F predicate = boost::filesystem::exists) {
|
||||||
while (starting_dir != "") {
|
while (starting_dir != "") {
|
||||||
const std::filesystem::path candidate = starting_dir / filename;
|
const boost::filesystem::path candidate = starting_dir / filename;
|
||||||
if (predicate(candidate)) {
|
if (predicate(candidate)) {
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,16 +55,13 @@ std::string create_logger_prefix(const fs::path& socket_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::optional<fs::path> find_wineprefix() {
|
std::optional<fs::path> find_wineprefix() {
|
||||||
// We need these string conversions because Boost still doesn't use
|
std::optional<fs::path> dosdevices_dir =
|
||||||
// std::filesystem paths
|
find_dominating_file("dosdevices", find_vst_plugin(), fs::is_directory);
|
||||||
std::optional<std::filesystem::path> dosdevices_dir =
|
if (!dosdevices_dir.has_value()) {
|
||||||
find_dominating_file("dosdevices", find_vst_plugin().string(),
|
return std::nullopt;
|
||||||
std::filesystem::is_directory);
|
|
||||||
if (dosdevices_dir.has_value()) {
|
|
||||||
return dosdevices_dir->parent_path().string();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::nullopt;
|
return dosdevices_dir->parent_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginArchitecture find_vst_architecture(fs::path plugin_path) {
|
PluginArchitecture find_vst_architecture(fs::path plugin_path) {
|
||||||
|
|||||||
Reference in New Issue
Block a user