mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
[yabridgectl] Disallow adding individual files
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user