Skip to content

Commit 9efa696

Browse files
committed
support absolute sample paths and expand ~/
1 parent 4f0af2a commit 9efa696

File tree

3 files changed

+76
-4
lines changed

3 files changed

+76
-4
lines changed

Cargo.lock

Lines changed: 66 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description = "Command line utility for generating sample streams for the Volca
44
documentation = "https://docs.rs/vsrs"
55
repository = "https://github.com/glindstedt/vsrs"
66
license = "LGPL-3.0-or-later"
7-
version = "0.2.2"
7+
version = "0.2.3"
88
authors = ["Gustaf Lindstedt <[email protected]>"]
99
edition = "2018"
1010
keywords = ["audio", "cli"]
@@ -27,5 +27,6 @@ ron = "0.6"
2727
serde = "1.0"
2828
serde_json = "1.0"
2929
serde_yaml = "0.8"
30+
shellexpand = "2.1"
3031
simple_logger = "1.11"
3132
wav = "0.5"

src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,14 @@ fn load(input_file: &str, output_file: &str) -> anyhow::Result<()> {
7575
for (index, sample_action) in samples {
7676
match sample_action {
7777
SampleAction::Sample(sample) => {
78-
let file_path = input_dir.join(sample.file).into_boxed_path();
78+
let file_path = {
79+
let expanded = shellexpand::tilde(sample.file.as_str());
80+
let path = Path::new(expanded.as_ref());
81+
match path.is_absolute() {
82+
true => path.into(),
83+
false => input_dir.join(path).into_boxed_path(),
84+
}
85+
};
7986
let (header, data) = read_sample(&file_path)?;
8087
let compression = sample.compression.or(volca_sample.default_compression);
8188

0 commit comments

Comments
 (0)