Skip to content

Commit 0a2da73

Browse files
committed
fix(binary search) We now exclude .git directories for faster search.
1 parent 29baadc commit 0a2da73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/compiler/utils.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ function M.find_files(start_dir, file_name)
1313
-- Create the find command with appropriate flags for recursive searching
1414
local find_command
1515
if package.config:sub(1, 1) == "\\" then -- Windows
16-
find_command = string.format('dir /s /b /a:-D "%s\\%s" 2>NUL', start_dir, file_name)
16+
find_command = string.format('powershell.exe -Command "Get-ChildItem -Path \\"%s\\" -Recurse -Filter \\"%s\\" -File -Exclude \\".git\\" -ErrorAction SilentlyContinue"', start_dir, file_name)
1717
else -- UNIX-like systems
18-
find_command = string.format('find "%s" -type f -name "%s" 2>/dev/null', start_dir, file_name)
18+
find_command = string.format('find "%s" -type d -name ".git" -prune -o -type f -name "%s" -print 2>/dev/null', start_dir, file_name)
1919
end
2020

2121
-- Execute the find command and capture the output

0 commit comments

Comments
 (0)