Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Add search support for multiple wildcards #3

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions src/wfsearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ FillSearchLB(HWND hwndLB, LPWSTR szSearchFileSpec, BOOL bRecurse, BOOL bIncludeS
INT iRet;
WCHAR szFileSpec[MAXPATHLEN+1];
WCHAR szPathName[MAXPATHLEN+1];
LPWCH lpszCurrentFileSpecStart;
LPWCH lpszCurrentFileSpecEnd;
LPXDTALINK lpStart = NULL;

//
Expand All @@ -473,21 +475,41 @@ FillSearchLB(HWND hwndLB, LPWSTR szSearchFileSpec, BOOL bRecurse, BOOL bIncludeS
StripPath(szFileSpec);
StripFilespec(szPathName);

FixUpFileSpec(szFileSpec);

lpszCurrentFileSpecEnd = szFileSpec;
maxExt = 0;

iDirsRead = 1;
dwLastUpdateTime = 0;
iRet = 0;

iRet = SearchList(hwndLB,
szPathName,
szFileSpec,
bRecurse,
bIncludeSubdirs,
&lpStart,
0,
TRUE);
//
// This loop runs for each subspec in the search string
//
while (*lpszCurrentFileSpecEnd) {
lpszCurrentFileSpecStart = lpszCurrentFileSpecEnd;

// Find the next separator or the end of the string
while ((*lpszCurrentFileSpecEnd) && (*lpszCurrentFileSpecEnd) != ';')
lpszCurrentFileSpecEnd++;
// If a separator is reached, add the string terminator and move the
// end after the terminator for the next cycle
if (*lpszCurrentFileSpecEnd == ';') {
*lpszCurrentFileSpecEnd = 0;
lpszCurrentFileSpecEnd++;
}

FixUpFileSpec(lpszCurrentFileSpecStart);

iRet += SearchList(hwndLB,
szPathName,
lpszCurrentFileSpecStart,
bRecurse,
bIncludeSubdirs,
&lpStart,
0,
TRUE);
}

//
// Only SetSel if none set already
Expand Down