Skip to content

Commit dc1fe58

Browse files
committed
fix: validate file exists
1 parent 8085def commit dc1fe58

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/media_info.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::metadata::*;
22
use regex::Regex;
3+
use std::fs;
34
use std::process::Command;
45

56
pub fn get_media_info(input: &str) -> OutputMetadata {
@@ -14,6 +15,9 @@ pub fn get_media_info(input: &str) -> OutputMetadata {
1415
cap,
1516
format!("{}", captures.get(cap).unwrap().as_str())
1617
);
18+
if !fs::metadata(&input).is_ok() {
19+
println!("{} is not found.", &input);
20+
std::process::exit(1);
1721
}
1822

1923
// TODO: Make the date optional

0 commit comments

Comments
 (0)