summaryrefslogtreecommitdiffstats
path: root/src/utils/path.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-11-09 07:39:21 +0800
committerGitHub <noreply@github.com>2024-11-09 07:39:21 +0800
commitb2dbd73b8c8938105246f04e6ebcd68221740bd7 (patch)
tree00e677ef3da0d1a7f6ccfeb504fd30d005ecb63e /src/utils/path.rs
parent58dde85033cff3f7b08fb7ae997f9e124ad52955 (diff)
downloadaichat-b2dbd73b8c8938105246f04e6ebcd68221740bd7.tar.gz
refactor: path related functions (#981)
Diffstat (limited to 'src/utils/path.rs')
-rw-r--r--src/utils/path.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/utils/path.rs b/src/utils/path.rs
index b0a5614..635604e 100644
--- a/src/utils/path.rs
+++ b/src/utils/path.rs
@@ -42,12 +42,8 @@ pub async fn expand_glob_paths<T: AsRef<str>>(paths: &[T]) -> Result<Vec<String>
Ok(new_paths)
}
-pub fn list_file_names<T: AsRef<Path>>(dir: Option<T>, ext: &str) -> Vec<String> {
- let dir = match dir {
- Some(v) => v,
- None => return vec![],
- };
- match std::fs::read_dir(dir) {
+pub fn list_file_names<T: AsRef<Path>>(dir: T, ext: &str) -> Vec<String> {
+ match std::fs::read_dir(dir.as_ref()) {
Ok(rd) => {
let mut names = vec![];
for entry in rd.flatten() {