From 709cdf79720991a890a6519dbf55954d61ab2823 Mon Sep 17 00:00:00 2001 From: Spider Date: Wed, 8 Nov 2023 15:22:50 +1100 Subject: [PATCH] Update path handling for ~ . --- src/bin/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index e732c5c..000df94 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -46,12 +46,20 @@ fn main() { ) .expect("Failed to set global default tracing subscriber"); } - let directory = matches + let path = matches .get_one::("input") .expect("required") .clone(); - let audio_info_string = AudioInfo::generate_audio_info_from_path(directory); + let full_path = match fs::canonicalize(path) { + Ok(full_path) => full_path, + Err(e) => { + eprintln!("Error: {}", e); + std::process::exit(1); + } + }; + + let audio_info_string = AudioInfo::generate_audio_info_from_path(full_path); if print { print!("{:}", audio_info_string);