mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-17 00:43:56 +02:00
Implement the status command
This commit is contained in:
@@ -14,12 +14,16 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use rayon::prelude::*;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::collections::BTreeSet;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::fmt::Display;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use xdg::BaseDirectories;
|
||||
|
||||
use crate::files::{self, SearchResults};
|
||||
|
||||
/// The name of the config file, relative to `$XDG_CONFIG_HOME/CONFIG_PREFIX`.
|
||||
const CONFIG_FILE_NAME: &str = "config.toml";
|
||||
/// The name of the XDG base directory prefix for yabridgectl, relative to `$XDG_CONFIG_HOME` and
|
||||
@@ -62,6 +66,15 @@ pub enum InstallationMethod {
|
||||
Symlink,
|
||||
}
|
||||
|
||||
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"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
@@ -150,6 +163,15 @@ impl Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Search for VST2 plugins in all of the registered plugins directories. This will return an
|
||||
/// error if `winedump` could not be called.
|
||||
pub fn index_directories(&self) -> Result<BTreeMap<&Path, SearchResults>, std::io::Error> {
|
||||
self.plugin_dirs
|
||||
.par_iter()
|
||||
.map(|path| files::index(path).map(|search_results| (path.as_path(), search_results)))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// Fetch the XDG base directories for yabridge's own files, converting any error messages if this
|
||||
|
||||
Reference in New Issue
Block a user