From c700806fa9976a643b5959d9fc2f032a95f16c83 Mon Sep 17 00:00:00 2001 From: Thomas Gotwig Date: Thu, 18 Jul 2024 21:01:54 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Make=20selector=20case-insensitive?= =?UTF-8?q?=20(mp4=20&=20MP4=20matches=20etc.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Close https://github.com/tgotwig/vidmerger/issues/47 --- CHANGELOG.md | 4 ++++ src/helpers/vec_helper.rs | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 264984d..d8215be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **--verbose** which prints detailed logs. +### Changed + +- Selector now case-insensitive, so it selects mp4 and MP4 etc. + ## 🎉 [0.3.2] - 2024-01-14 ### Added diff --git a/src/helpers/vec_helper.rs b/src/helpers/vec_helper.rs index a8c7e57..fa800a9 100644 --- a/src/helpers/vec_helper.rs +++ b/src/helpers/vec_helper.rs @@ -5,8 +5,9 @@ use regex::Regex; /// Returns a vector of PathBufs that match the given file format. /// Also filters out files that start with a dot. pub fn filter_files(all_files: Vec, file_format: &str) -> Vec { - let re = Regex::new(format!(r"[\\/][^.\\/][^\\/]*\.{}$", regex::escape(file_format)).as_str()) - .unwrap(); + let re: Regex = + Regex::new(format!(r"(?i)[\\/][^.\\/][^\\/]*\.{}$", regex::escape(file_format)).as_str()) + .unwrap(); let mut filtered_files = Vec::new(); for possible_file_to_merge in all_files {