mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Resolve relative paths in yabridgectl
This commit is contained in:
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic
|
and this project adheres to [Semantic
|
||||||
Versioning](https://semver.org/spec/v2.0.0.html).
|
Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### yabridgectl
|
||||||
|
|
||||||
|
- Resolve relative paths when adding plugin directories or when changing
|
||||||
|
settings.
|
||||||
|
|
||||||
## [1.6.0] - 2020-09-17
|
## [1.6.0] - 2020-09-17
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -121,13 +121,24 @@ fn main() -> Result<()> {
|
|||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
|
// We're calling canonicalize when adding and setting paths since relative paths would cause
|
||||||
|
// some weird behaviour. There's no built-in way to make relative paths absoltue without
|
||||||
|
// resolving symlinks, but I don't think this will cause any issues.
|
||||||
|
//
|
||||||
|
// https://github.com/rust-lang/rust/issues/59117
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
("add", Some(options)) => {
|
("add", Some(options)) => actions::add_directory(
|
||||||
actions::add_directory(&mut config, options.value_of_t_or_exit("path"))
|
&mut config,
|
||||||
}
|
options
|
||||||
("rm", Some(options)) => {
|
.value_of_t_or_exit::<PathBuf>("path")
|
||||||
actions::remove_directory(&mut config, &options.value_of_t_or_exit::<PathBuf>("path"))
|
.canonicalize()?,
|
||||||
}
|
),
|
||||||
|
("rm", Some(options)) => actions::remove_directory(
|
||||||
|
&mut config,
|
||||||
|
&options
|
||||||
|
.value_of_t_or_exit::<PathBuf>("path")
|
||||||
|
.canonicalize()?,
|
||||||
|
),
|
||||||
("list", _) => actions::list_directories(&config),
|
("list", _) => actions::list_directories(&config),
|
||||||
("status", _) => actions::show_status(&config),
|
("status", _) => actions::show_status(&config),
|
||||||
("set", Some(options)) => actions::set_settings(
|
("set", Some(options)) => actions::set_settings(
|
||||||
@@ -136,7 +147,10 @@ fn main() -> Result<()> {
|
|||||||
method: options.value_of("method"),
|
method: options.value_of("method"),
|
||||||
// We've already verified that the path is valid, so we should only be getting
|
// We've already verified that the path is valid, so we should only be getting
|
||||||
// errors for missing arguments
|
// errors for missing arguments
|
||||||
path: options.value_of_t("path").ok(),
|
path: options
|
||||||
|
.value_of_t::<PathBuf>("path")
|
||||||
|
.ok()
|
||||||
|
.and_then(|path| path.canonicalize().ok()),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
("sync", Some(options)) => actions::do_sync(
|
("sync", Some(options)) => actions::do_sync(
|
||||||
|
|||||||
Reference in New Issue
Block a user