mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-19 18:03:56 +02:00
Update yabridgectl for libyabridge-vst2.so
This commit is contained in:
@@ -13,11 +13,11 @@ from anywhere. All of the information below can also be found through
|
|||||||
|
|
||||||
### Yabridge path
|
### Yabridge path
|
||||||
|
|
||||||
Yabridgectl will need to know where it can find `libyabridge.so`. By default it
|
Yabridgectl will need to know where it can find the `libyabridge-vst*.so` files.
|
||||||
will search for it in both `~/.local/share/yabridge` (the recommended
|
By default it will search for it in both `~/.local/share/yabridge` (the
|
||||||
installation directory when using the prebuilt binaries) and in `/usr/lib`. You
|
recommended installation directory when using the prebuilt binaries) and in
|
||||||
can use the command below to override this behaviour and to use a custom
|
`/usr/lib`. You can use the command below to override this behaviour and to use
|
||||||
installation directory instead.
|
a custom installation directory instead.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
yabridgectl set --path=<path/to/directory/containing/yabridge/files>
|
yabridgectl set --path=<path/to/directory/containing/yabridge/files>
|
||||||
@@ -77,6 +77,11 @@ yabridgectl sync --force
|
|||||||
|
|
||||||
## Alternatives
|
## Alternatives
|
||||||
|
|
||||||
|
TODO: This now only mentions how to do this for VST2 plugins. We should probably
|
||||||
|
just drop this section altogether since using yabridgectl is so much easier, and
|
||||||
|
if someone really wants to do this by hand then they'll be able to whip up their
|
||||||
|
own script based on the instructions in the main readme.
|
||||||
|
|
||||||
If you want to script your own installation behaviour and don't feel like using
|
If you want to script your own installation behaviour and don't feel like using
|
||||||
yabridgectl, then you could use one of the below bash snippets instead. This
|
yabridgectl, then you could use one of the below bash snippets instead. This
|
||||||
approach is slightly less robust and does not perform any problem detection or
|
approach is slightly less robust and does not perform any problem detection or
|
||||||
|
|||||||
@@ -96,9 +96,9 @@ pub fn show_status(config: &Config) -> Result<()> {
|
|||||||
.unwrap_or_else(|| String::from("<auto>"))
|
.unwrap_or_else(|| String::from("<auto>"))
|
||||||
);
|
);
|
||||||
println!(
|
println!(
|
||||||
"libyabridge.so: {}",
|
"libyabridge-vst2.so: {}",
|
||||||
config
|
config
|
||||||
.libyabridge()
|
.libyabridge_vst2()
|
||||||
.map(|path| format!("'{}'", path.display()))
|
.map(|path| format!("'{}'", path.display()))
|
||||||
.unwrap_or_else(|_| format!("{}", "<not found>".red()))
|
.unwrap_or_else(|_| format!("{}", "<not found>".red()))
|
||||||
);
|
);
|
||||||
@@ -154,9 +154,9 @@ pub struct SyncOptions {
|
|||||||
/// Set up yabridge for all Windows VST2 plugins in the plugin directories. Will also remove orphan
|
/// Set up yabridge for all Windows VST2 plugins in the plugin directories. Will also remove orphan
|
||||||
/// `.so` files if the prune option is set.
|
/// `.so` files if the prune option is set.
|
||||||
pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
|
pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
|
||||||
let libyabridge_path = config.libyabridge()?;
|
let libyabridge_vst2_path = config.libyabridge_vst2()?;
|
||||||
let libyabridge_hash = utils::hash_file(&libyabridge_path)?;
|
let libyabridge_vst2_hash = utils::hash_file(&libyabridge_vst2_path)?;
|
||||||
println!("Using '{}'\n", libyabridge_path.display());
|
println!("Using '{}'\n", libyabridge_vst2_path.display());
|
||||||
|
|
||||||
let results = config
|
let results = config
|
||||||
.index_directories()
|
.index_directories()
|
||||||
@@ -188,19 +188,19 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
|
|||||||
match (options.force, &config.method) {
|
match (options.force, &config.method) {
|
||||||
(false, InstallationMethod::Copy) => {
|
(false, InstallationMethod::Copy) => {
|
||||||
// If the target file is already a real file (not a symlink) and its hash is
|
// If the target file is already a real file (not a symlink) and its hash is
|
||||||
// the same as the `libyabridge.so` file we're trying to copy there, then we
|
// the same as the `libyabridge-vst2.so` file we're trying to copy there,
|
||||||
// don't have to do anything
|
// then we don't have to do anything
|
||||||
if metadata.file_type().is_file()
|
if metadata.file_type().is_file()
|
||||||
&& utils::hash_file(&target_path)? == libyabridge_hash
|
&& utils::hash_file(&target_path)? == libyabridge_vst2_hash
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(false, InstallationMethod::Symlink) => {
|
(false, InstallationMethod::Symlink) => {
|
||||||
// If the target file is already a symlink to `libyabridge.so`, then we can
|
// If the target file is already a symlink to `libyabridge-vst2.so`, then we
|
||||||
// skip this file
|
// can skip this file
|
||||||
if metadata.file_type().is_symlink()
|
if metadata.file_type().is_symlink()
|
||||||
&& target_path.read_link()? == libyabridge_path
|
&& target_path.read_link()? == libyabridge_vst2_path
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -217,10 +217,10 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
|
|||||||
num_new += 1;
|
num_new += 1;
|
||||||
match config.method {
|
match config.method {
|
||||||
InstallationMethod::Copy => {
|
InstallationMethod::Copy => {
|
||||||
utils::copy(&libyabridge_path, &target_path)?;
|
utils::copy(&libyabridge_vst2_path, &target_path)?;
|
||||||
}
|
}
|
||||||
InstallationMethod::Symlink => {
|
InstallationMethod::Symlink => {
|
||||||
utils::symlink(&libyabridge_path, &target_path)?;
|
utils::symlink(&libyabridge_vst2_path, &target_path)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ pub const CONFIG_FILE_NAME: &str = "config.toml";
|
|||||||
const YABRIDGECTL_PREFIX: &str = "yabridgectl";
|
const YABRIDGECTL_PREFIX: &str = "yabridgectl";
|
||||||
|
|
||||||
/// The name of the library file we're searching for.
|
/// The name of the library file we're searching for.
|
||||||
pub const LIBYABRIDGE_NAME: &str = "libyabridge.so";
|
pub const LIBYABRIDGE_VST2_NAME: &str = "libyabridge-vst2.so";
|
||||||
/// The name of the script we're going to run to verify that everything's working correctly.
|
/// The name of the script we're going to run to verify that everything's working correctly.
|
||||||
pub const YABRIDGE_HOST_EXE_NAME: &str = "yabridge-host.exe";
|
pub const YABRIDGE_HOST_EXE_NAME: &str = "yabridge-host.exe";
|
||||||
/// The name of the XDG base directory prefix for yabridge's own files, relative to
|
/// The name of the XDG base directory prefix for yabridge's own files, relative to
|
||||||
@@ -66,11 +66,11 @@ pub struct Config {
|
|||||||
#[derive(Deserialize, Serialize, Debug, PartialEq, Eq)]
|
#[derive(Deserialize, Serialize, Debug, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum InstallationMethod {
|
pub enum InstallationMethod {
|
||||||
/// Create a copy of `libyabridge.so` for every Windows VST2 plugin .dll file found. After
|
/// Create a copy of `libyabridge-vst2.so` for every Windows VST2 plugin .dll file found. After
|
||||||
/// updating yabridge, the user will have to rerun `yabridgectl sync` to copy over the new
|
/// updating yabridge, the user will have to rerun `yabridgectl sync` to copy over the new
|
||||||
/// version.
|
/// version.
|
||||||
Copy,
|
Copy,
|
||||||
/// This will create a symlink to `libyabridge.so` for every VST2 .dll file in the plugin
|
/// This will create a symlink to `libyabridge-vst2.so` for every VST2 .dll file in the plugin
|
||||||
/// directories. As explained in the readme, this makes updating easier and remvoes the need to
|
/// directories. As explained in the readme, this makes updating easier and remvoes the need to
|
||||||
/// modify the `PATH` environment variable.
|
/// modify the `PATH` environment variable.
|
||||||
Symlink,
|
Symlink,
|
||||||
@@ -158,19 +158,19 @@ impl Config {
|
|||||||
.with_context(|| format!("Failed to write config file to '{}'", config_path.display()))
|
.with_context(|| format!("Failed to write config file to '{}'", config_path.display()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the path to `libyabridge.so`, or a descriptive error if it can't be found. If
|
/// Return the path to `libyabridge-vst2.so`, or a descriptive error if it can't be found. If
|
||||||
/// `yabridge_home` is `None`, then we'll search in both `/usr/lib` and
|
/// `yabridge_home` is `None`, then we'll search in both `/usr/lib` and
|
||||||
/// `$XDG_DATA_HOME/yabridge`.
|
/// `$XDG_DATA_HOME/yabridge`.
|
||||||
pub fn libyabridge(&self) -> Result<PathBuf> {
|
pub fn libyabridge_vst2(&self) -> Result<PathBuf> {
|
||||||
match &self.yabridge_home {
|
match &self.yabridge_home {
|
||||||
Some(directory) => {
|
Some(directory) => {
|
||||||
let candidate = directory.join(LIBYABRIDGE_NAME);
|
let candidate = directory.join(LIBYABRIDGE_VST2_NAME);
|
||||||
if candidate.exists() {
|
if candidate.exists() {
|
||||||
Ok(candidate)
|
Ok(candidate)
|
||||||
} else {
|
} else {
|
||||||
Err(anyhow!(
|
Err(anyhow!(
|
||||||
"Could not find '{}' in '{}'",
|
"Could not find '{}' in '{}'",
|
||||||
LIBYABRIDGE_NAME,
|
LIBYABRIDGE_VST2_NAME,
|
||||||
directory.display()
|
directory.display()
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -179,12 +179,12 @@ impl Config {
|
|||||||
// Search in the two common installation locations if no path was set explicitely.
|
// Search in the two common installation locations if no path was set explicitely.
|
||||||
// We'll also search through `/usr/local/lib` just in case but since we advocate
|
// We'll also search through `/usr/local/lib` just in case but since we advocate
|
||||||
// against isntalling yabridge there we won't list this path in the error message
|
// against isntalling yabridge there we won't list this path in the error message
|
||||||
// when `libyabridge.so` can't be found.
|
// when `libyabridge-vst2.so` can't be found.
|
||||||
let system_path = Path::new("/usr/lib");
|
let system_path = Path::new("/usr/lib");
|
||||||
let system_path_alt = Path::new("/usr/local/lib");
|
let system_path_alt = Path::new("/usr/local/lib");
|
||||||
let user_path = yabridge_directories()?.get_data_home();
|
let user_path = yabridge_directories()?.get_data_home();
|
||||||
for directory in &[system_path, system_path_alt, &user_path] {
|
for directory in &[system_path, system_path_alt, &user_path] {
|
||||||
let candidate = directory.join(LIBYABRIDGE_NAME);
|
let candidate = directory.join(LIBYABRIDGE_VST2_NAME);
|
||||||
if candidate.exists() {
|
if candidate.exists() {
|
||||||
return Ok(candidate);
|
return Ok(candidate);
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ impl Config {
|
|||||||
Err(anyhow!(
|
Err(anyhow!(
|
||||||
"Could not find '{}' in either '{}' or '{}'. You can override the default \
|
"Could not find '{}' in either '{}' or '{}'. You can override the default \
|
||||||
search path using 'yabridgectl set --path=<path>'.",
|
search path using 'yabridgectl set --path=<path>'.",
|
||||||
LIBYABRIDGE_NAME,
|
LIBYABRIDGE_VST2_NAME,
|
||||||
system_path.display(),
|
system_path.display(),
|
||||||
user_path.display()
|
user_path.display()
|
||||||
))
|
))
|
||||||
@@ -202,11 +202,11 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Return the path to `yabridge-host.exe`, or a descriptive error if it can't be found. This
|
/// Return the path to `yabridge-host.exe`, or a descriptive error if it can't be found. This
|
||||||
/// will first search alongside `libyabridge.so` and then search through the search path.
|
/// will first search alongside `libyabridge-vst2.so` and then search through the search path.
|
||||||
pub fn yabridge_host_exe(&self) -> Result<PathBuf> {
|
pub fn yabridge_host_exe(&self) -> Result<PathBuf> {
|
||||||
let libyabridge_path = self.libyabridge()?;
|
let yabridge_path = self.libyabridge_vst2()?;
|
||||||
|
|
||||||
let yabridge_host_exe_candidate = libyabridge_path.with_file_name(YABRIDGE_HOST_EXE_NAME);
|
let yabridge_host_exe_candidate = yabridge_path.with_file_name(YABRIDGE_HOST_EXE_NAME);
|
||||||
if yabridge_host_exe_candidate.exists() {
|
if yabridge_host_exe_candidate.exists() {
|
||||||
return Ok(yabridge_host_exe_candidate);
|
return Ok(yabridge_host_exe_candidate);
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ impl Config {
|
|||||||
|
|
||||||
/// Fetch the XDG base directories for yabridge's own files, converting any error messages if this
|
/// Fetch the XDG base directories for yabridge's own files, converting any error messages if this
|
||||||
/// somehow fails into a printable string to reduce boiler plate. This is only used when searching
|
/// somehow fails into a printable string to reduce boiler plate. This is only used when searching
|
||||||
/// for `libyabridge.so` when no explicit search path has been set.
|
/// for `libyabridge-{vst2,vst3}.so` when no explicit search path has been set.
|
||||||
pub fn yabridge_directories() -> Result<BaseDirectories> {
|
pub fn yabridge_directories() -> Result<BaseDirectories> {
|
||||||
BaseDirectories::with_prefix(YABRIDGE_PREFIX).context("Error while parsing base directories")
|
BaseDirectories::with_prefix(YABRIDGE_PREFIX).context("Error while parsing base directories")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ pub enum FoundFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SearchResults {
|
impl SearchResults {
|
||||||
/// For every found VST2 plugin, find the associated copy or symlink of `libyabridge.so`. The
|
/// For every found VST2 plugin, find the associated copy or symlink of `libyabridge-vst2.so`.
|
||||||
/// returned hashmap will contain a `None` value for plugins that have not yet been set up.
|
/// The returned hashmap will contain a `None` value for plugins that have not yet been set up.
|
||||||
///
|
///
|
||||||
/// These two functions could be combined into a single function, but speed isn't really an
|
/// These two functions could be combined into a single function, but speed isn't really an
|
||||||
/// issue here and it's a bit more organized this way.
|
/// issue here and it's a bit more organized this way.
|
||||||
|
|||||||
@@ -99,10 +99,10 @@ fn main() -> Result<()> {
|
|||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("path")
|
Arg::with_name("path")
|
||||||
.long("path")
|
.long("path")
|
||||||
.about("Path to the directory containing 'libyabridge.so'")
|
.about("Path to the directory containing 'libyabridge-{vst2,vst3}.so'")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Path to the directory containing 'libyabridge.so'. If this is \
|
"Path to the directory containing 'libyabridge-{vst2,vst3}.so'. If this \
|
||||||
not set, then yabridgectl will look in both '/usr/lib' and \
|
is not set, then yabridgectl will look in both '/usr/lib' and \
|
||||||
'~/.local/share/yabridge' by default.",
|
'~/.local/share/yabridge' by default.",
|
||||||
)
|
)
|
||||||
.validator(validate_path)
|
.validator(validate_path)
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ pub fn verify_path_setup(config: &Config) -> Result<bool> {
|
|||||||
reboot your system to complete the setup.\n\
|
reboot your system to complete the setup.\n\
|
||||||
\n\
|
\n\
|
||||||
https://github.com/robbert-vdh/yabridge#troubleshooting-common-issues",
|
https://github.com/robbert-vdh/yabridge#troubleshooting-common-issues",
|
||||||
config.libyabridge()?.parent().unwrap().display(),
|
config.libyabridge_vst2()?.parent().unwrap().display(),
|
||||||
shell.bright_white(),
|
shell.bright_white(),
|
||||||
"PATH".bright_white()
|
"PATH".bright_white()
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user