[yabridgectl] Remove symlink installation method

This commit is contained in:
Robbert van der Helm
2022-04-16 21:00:56 +02:00
parent 9420bade62
commit f62d06e085
5 changed files with 21 additions and 134 deletions
+1 -53
View File
@@ -21,7 +21,6 @@ use rayon::prelude::*;
use serde_derive::{Deserialize, Serialize};
use std::collections::{BTreeMap, BTreeSet, HashSet};
use std::env;
use std::fmt::Display;
use std::fs;
use std::path::{Path, PathBuf};
use which::which;
@@ -57,12 +56,9 @@ const YABRIDGE_VST3_HOME: &str = ".vst3/yabridge";
/// The configuration used for yabridgectl. This will be serialized to and deserialized from
/// `$XDG_CONFIG_HOME/yabridge/config.toml`.
#[derive(Deserialize, Serialize, Debug)]
#[derive(Debug, Default, Deserialize, Serialize)]
#[serde(default)]
pub struct Config {
/// The installation method to use. We will default to creating copies since that works
/// everywhere.
pub method: InstallationMethod,
/// The path to the directory containing `libyabridge-{chainloader,}-{vst2,vst3}.so`. If not
/// set, then yabridgectl will look in `/usr/lib` and `$XDG_DATA_HOME/yabridge` since those are
/// the expected locations for yabridge to be installed in.
@@ -86,41 +82,6 @@ pub struct Config {
pub last_known_config: Option<KnownConfig>,
}
/// Specifies how yabridge will be set up for the found plugins.
#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum InstallationMethod {
/// Create a copy of `libyabridge-chainloader-{vst2,vst3}.so` for every Windows VST2 plugin
/// `.dll` file or VST3 module found. After updating yabridge, the user will have to rerun
/// `yabridgectl sync` to copy over the new version.
Copy,
/// This will create a symlink to `libyabridge-chainloader-{vst2,vst3}.so` for every VST2 plugin
/// `.dll` file or VST3 module in the plugin directories. Now that yabridge also searches in
/// `~/.local/share/yabridge` since yabridge 2.1 this option is not really needed anymore.
///
/// TODO: This feature has been deprecated, remove it in yabridge 4.0
Symlink,
}
impl InstallationMethod {
/// The plural term for this installation methodd, using in string formatting.
pub fn plural_name(&self) -> &str {
match &self {
InstallationMethod::Copy => "copies",
InstallationMethod::Symlink => "symlinks",
}
}
}
impl Display for InstallationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &self {
InstallationMethod::Copy => write!(f, "copy"),
InstallationMethod::Symlink => write!(f, "symlink"),
}
}
}
/// Stores information about a combination of Wine and yabridge that works together properly.
/// Whenever we encounter a new version of Wine or yabridge, we'll check whether `yabridge-host.exe`
/// can run without issues. This is needed because older versions of Wine won't be able to run newer
@@ -168,19 +129,6 @@ pub struct YabridgeFiles {
pub yabridge_host_32_exe_so: Option<PathBuf>,
}
impl Default for Config {
fn default() -> Self {
Config {
method: InstallationMethod::Copy,
yabridge_home: None,
plugin_dirs: BTreeSet::new(),
no_verify: false,
blacklist: BTreeSet::new(),
last_known_config: None,
}
}
}
impl Config {
/// Try to read the config file, creating a new default file if necessary. This will fail if the
/// file could not be created or if it could not be parsed.