(
path: &FsPath,
root: &FsPath,
pattern: &str,
results: &mut Vec<SearchResult>,
)
| 3096 | } |
| 3097 | |
| 3098 | fn search_recursive( |
| 3099 | path: &FsPath, |
| 3100 | root: &FsPath, |
| 3101 | pattern: &str, |
| 3102 | results: &mut Vec<SearchResult>, |
| 3103 | ) { |
| 3104 | if path.is_dir() { |
| 3105 | if let Ok(entries) = std::fs::read_dir(path) { |
| 3106 | for entry in entries.flatten() { |
| 3107 | let path_buf = entry.path(); |
| 3108 | if !is_within_root(&path_buf, root) { |
| 3109 | continue; |
| 3110 | } |
| 3111 | if path_buf.is_dir() { |
| 3112 | search_recursive(&path_buf, root, pattern, results); |
| 3113 | } else if path_buf.is_file() { |
| 3114 | search_in_file(&path_buf, pattern, results); |
| 3115 | } |
| 3116 | } |
| 3117 | } |
| 3118 | } |
| 3119 | } |
| 3120 | |
| 3121 | search_recursive(&base_path, &root, &query.pattern, &mut results); |
| 3122 | Ok(Json(results)) |
no test coverage detected