refactor: allow dot files and directories in file search logic
This commit is contained in:
@@ -313,7 +313,7 @@ pub async fn search_files(
|
|||||||
|
|
||||||
let name = entry.file_name();
|
let name = entry.file_name();
|
||||||
let name_str = name.to_string_lossy();
|
let name_str = name.to_string_lossy();
|
||||||
if name_str.is_empty() || name_str.starts_with('.') {
|
if name_str.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,9 +569,6 @@ fn clamp_search_limit(value: Option<usize>) -> usize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn should_skip_directory(name: &str) -> bool {
|
fn should_skip_directory(name: &str) -> bool {
|
||||||
if name.starts_with('.') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
FILE_SEARCH_EXCLUDED_DIRS
|
FILE_SEARCH_EXCLUDED_DIRS
|
||||||
.iter()
|
.iter()
|
||||||
.any(|dir| dir.eq_ignore_ascii_case(name))
|
.any(|dir| dir.eq_ignore_ascii_case(name))
|
||||||
|
|||||||
@@ -400,7 +400,6 @@ export const FilesView: React.FC = () => {
|
|||||||
const mapDirectoryEntries = React.useCallback((dirPath: string, entries: Array<{ name: string; path: string; isDirectory: boolean }>): FileNode[] => {
|
const mapDirectoryEntries = React.useCallback((dirPath: string, entries: Array<{ name: string; path: string; isDirectory: boolean }>): FileNode[] => {
|
||||||
const nodes = entries
|
const nodes = entries
|
||||||
.filter((entry) => entry && typeof entry.name === 'string' && entry.name.length > 0)
|
.filter((entry) => entry && typeof entry.name === 'string' && entry.name.length > 0)
|
||||||
.filter((entry) => !entry.name.startsWith('.'))
|
|
||||||
.filter((entry) => !shouldIgnoreEntryName(entry.name))
|
.filter((entry) => !shouldIgnoreEntryName(entry.name))
|
||||||
.map<FileNode>((entry) => {
|
.map<FileNode>((entry) => {
|
||||||
const name = entry.name;
|
const name = entry.name;
|
||||||
|
|||||||
@@ -72,9 +72,7 @@ const shouldSkipSearchDirectory = (name) => {
|
|||||||
if (!name) {
|
if (!name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (name.startsWith('.')) {
|
// allow dot dirs/files; still skip excluded dirs below
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return FILE_SEARCH_EXCLUDED_DIRS.has(name.toLowerCase());
|
return FILE_SEARCH_EXCLUDED_DIRS.has(name.toLowerCase());
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -178,7 +176,7 @@ const searchFilesystemFiles = async (rootPath, options) => {
|
|||||||
|
|
||||||
for (const dirent of dirents) {
|
for (const dirent of dirents) {
|
||||||
const entryName = dirent.name;
|
const entryName = dirent.name;
|
||||||
if (!entryName || entryName.startsWith('.')) {
|
if (!entryName) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user