This PR allows users to provide the list of excluding folder names/patterns in "Filters" field.
Eclusion operator is alway "!" at the begining. In order to distinguish folder from file, "\" should be used as prefix of the folder name/pattern, following "!". That allows the exclusion of the directories under the root directory you want to search (the 1st level of matched directories).
If users need to exclude folders with the same name (or names matched the specific pattern) in all levels, the + should be put between "!" and "\" to exclude them recursively.
Here is a sample:
Filters: *.* !\bin !+\test !+\log*
Directory: c:\myProject\
So the excluded directories could be:
c:\myProject\bin\
c:\myProject\log\
c:\myProject\logs\
c:\myProject\src\log4j\
c:\myProject\test\
c:\myProject\src\test\
The following directories will not be excluded:
c:\myProject\foo\tests\
c:\myProject\foo\bin\
Note that "inclusion of folder" is not allowed, and such pattern will be ignored.
Fix#2433, fix#8350, close#10927
if(patterLen>3&&patterns[i][0]=='!'&&patterns[i][1]=='+'&&patterns[i][2]=='\\')// check for !+\folderPattern: for all levels - search this pattern recursively
{
if(PathMatchSpec(dirName,patterns[i].c_str()+3))
returntrue;
}
elseif(patterLen>2&&patterns[i][0]=='!'&&patterns[i][1]=='\\')// check for !\folderPattern: exclusive pattern for only the 1st level
generic_stringfindInFilesFilterTip=pNativeSpeaker->getLocalizedStrFromID("find-in-files-filter-tip",TEXT("Find in cpp, cxx, h, hxx && hpp:\r*.cpp *.cxx *.h *.hxx *.hpp\r\rFind in all files except exe, obj && log:\r*.* !*.exe !*.obj !*.log"));
generic_stringfindInFilesFilterTip=pNativeSpeaker->getLocalizedStrFromID("find-in-files-filter-tip",TEXT("Find in cpp, cxx, h, hxx && hpp:\r*.cpp *.cxx *.h *.hxx *.hpp\r\rFind in all files except exe, obj && log:\r*.* !*.exe !*.obj !*.log\r\rFind in all files but exclude folders tests, bin && bin64:\r*.* !\\tests !\\bin*\r\rFind in all files but exclude all folders log or logs recursively:\r*.* !+\\log*"));