[yabridgectl] Disallow adding individual files

This commit is contained in:
Robbert van der Helm
2022-01-12 13:56:09 +01:00
parent 8382384fc1
commit 1f16c2bf1a
2 changed files with 18 additions and 2 deletions
+4
View File
@@ -53,6 +53,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).
### yabridgectl
- Yabridgectl's help text received some new colors.
- Disallowed adding (symlinks to) individual files with `yabridgectl add`.
Yabridgectl was never intended to be used that way, and while it does sort of
work, it will lead to certain surprises down the line.
- Deprecated support for the symlink-based installation method in yabridgectl
and removed all remaining mentions of it from the documentation. This feature
has for all intents and purposes already been obselete since yabridge 2.1.0,
+14 -2
View File
@@ -60,8 +60,8 @@ fn main() -> Result<()> {
.display_order(1)
.arg(
Arg::new("path")
.help("Path to a directory containing Windows VST plugins")
.validator(validate_path)
.help("Path to a directory containing Windows VST2 or VST3 plugins")
.validator(validate_directory)
.takes_value(true)
.required(true),
),
@@ -301,6 +301,18 @@ fn main() -> Result<()> {
}
}
/// Verify that a path exists and that is is either a directory or a symlink to a directory.
fn validate_directory(path: &str) -> Result<(), String> {
validate_path(path)?;
let path = Path::new(path);
if path.is_dir() {
Ok(())
} else {
Err(format!("'{}' is not a directory", path.display()))
}
}
/// Verify that a path exists, used for validating arguments.
fn validate_path(path: &str) -> Result<(), String> {
let path = Path::new(path);