Skip to content

Commit

Permalink
support absolute sample paths and expand ~/
Browse files Browse the repository at this point in the history
  • Loading branch information
glindstedt committed Jan 3, 2021
1 parent 4f0af2a commit 9efa696
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 4 deletions.
68 changes: 66 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Command line utility for generating sample streams for the Volca
documentation = "https://docs.rs/vsrs"
repository = "https://github.com/glindstedt/vsrs"
license = "LGPL-3.0-or-later"
version = "0.2.2"
version = "0.2.3"
authors = ["Gustaf Lindstedt <[email protected]>"]
edition = "2018"
keywords = ["audio", "cli"]
Expand All @@ -27,5 +27,6 @@ ron = "0.6"
serde = "1.0"
serde_json = "1.0"
serde_yaml = "0.8"
shellexpand = "2.1"
simple_logger = "1.11"
wav = "0.5"
9 changes: 8 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ fn load(input_file: &str, output_file: &str) -> anyhow::Result<()> {
for (index, sample_action) in samples {
match sample_action {
SampleAction::Sample(sample) => {
let file_path = input_dir.join(sample.file).into_boxed_path();
let file_path = {
let expanded = shellexpand::tilde(sample.file.as_str());
let path = Path::new(expanded.as_ref());
match path.is_absolute() {
true => path.into(),
false => input_dir.join(path).into_boxed_path(),
}
};
let (header, data) = read_sample(&file_path)?;
let compression = sample.compression.or(volca_sample.default_compression);

Expand Down

0 comments on commit 9efa696

Please sign in to comment.