{
// 1. Test against filters
if (pCtxt->m_piFilterGlobal==nullptr ||
- (nDirs == 2 && pCtxt->m_piFilterGlobal->includeFile(
- paths::ConcatPath(di.diffFileInfo[0].path, di.diffFileInfo[0].filename),
- paths::ConcatPath(di.diffFileInfo[1].path, di.diffFileInfo[1].filename)
- )) ||
- (nDirs == 3 && pCtxt->m_piFilterGlobal->includeFile(
- paths::ConcatPath(di.diffFileInfo[0].path, di.diffFileInfo[0].filename),
- paths::ConcatPath(di.diffFileInfo[1].path, di.diffFileInfo[1].filename),
- paths::ConcatPath(di.diffFileInfo[2].path, di.diffFileInfo[2].filename)
- )))
+ (nDirs == 2 && pCtxt->m_piFilterGlobal->includeFile(di.diffFileInfo[0].filename, di.diffFileInfo[1].filename)) ||
+ (nDirs == 3 && pCtxt->m_piFilterGlobal->includeFile(di.diffFileInfo[0].filename, di.diffFileInfo[1].filename, di.diffFileInfo[2].filename))
+ )
{
di.diffcode.diffcode |= DIFFCODE::INCLUDED;
di.diffcode.diffcode |= fc.prepAndCompareFiles(di);
Poco::RegularExpression regexp; /**< Compiled regular expression */
std::string _regex; /**< Regular expression string to set to Poco::RegularExpression */
int _reOpts; /**< Options to set to Poco::RegularExpression */
- bool _fileNameOnly; /**< If true, indicates that the filter matches only filenames */
- FileFilterElement(const std::string& regex, int reOpts, bool fileFilter) :
- regexp(regex, reOpts), _regex(regex), _reOpts(reOpts), _fileNameOnly(fileFilter && regex.find("\\\\", 0) == String::npos)
+ FileFilterElement(const std::string& regex, int reOpts) : regexp(regex, reOpts), _regex(regex), _reOpts(reOpts)
{
}
- FileFilterElement(const FileFilterElement* element) :
- regexp(element->_regex, element->_reOpts), _regex(element->_regex), _reOpts(element->_reOpts), _fileNameOnly(element->_fileNameOnly)
+ FileFilterElement(const FileFilterElement* element) : regexp(element->_regex, element->_reOpts), _regex(element->_regex), _reOpts(element->_reOpts)
{
}
};
using Poco::icompare;
using Poco::RegularExpression;
-static void AddFilterPattern(vector<FileFilterElementPtr> *filterList, String & str, bool fileFilter);
+static void AddFilterPattern(vector<FileFilterElementPtr> *filterList, String & str);
/**
* @brief Destructor, frees all filters.
* @param [in] filterList List where pattern is added.
* @param [in] str Temporary variable (ie, it may be altered)
*/
-static void AddFilterPattern(vector<FileFilterElementPtr> *filterList, String & str, bool fileFilter)
+static void AddFilterPattern(vector<FileFilterElementPtr> *filterList, String & str)
{
const String& commentLeader = _T("##"); // Starts comment
str = strutils::trim_ws_begin(str);
re_opts |= RegularExpression::RE_UTF8;
try
{
- filterList->push_back(FileFilterElementPtr(new FileFilterElement(regexString, re_opts, fileFilter)));
+ filterList->push_back(FileFilterElementPtr(new FileFilterElement(regexString, re_opts)));
}
catch (...)
{
{
// file filter
String str = sLine.substr(2);
- AddFilterPattern(&pfilter->filefilters, str, true);
+ AddFilterPattern(&pfilter->filefilters, str);
}
else if (0 == sLine.compare(0, 2, _T("d:"), 2))
{
// directory filter
String str = sLine.substr(2);
- AddFilterPattern(&pfilter->dirfilters, str, false);
+ AddFilterPattern(&pfilter->dirfilters, str);
}
else if (0 == sLine.compare(0, 3, _T("f!:"), 3))
{
// file filter
String str = sLine.substr(3);
- AddFilterPattern(&pfilter->filefiltersExclude, str, true);
+ AddFilterPattern(&pfilter->filefiltersExclude, str);
}
else if (0 == sLine.compare(0, 3, _T("d!:"), 3))
{
// directory filter
String str = sLine.substr(3);
- AddFilterPattern(&pfilter->dirfiltersExclude, str, false);
+ AddFilterPattern(&pfilter->dirfiltersExclude, str);
}
} while (bLinesLeft);
if (filterList->size() == 0)
return false;
- std::string compString, compStringFileName;
+ std::string compString;
ucr::toUTF8(szTest, compString);
vector<FileFilterElementPtr>::const_iterator iter = filterList->begin();
while (iter != filterList->end())
RegularExpression::Match match;
try
{
- if ((*iter)->_fileNameOnly && compStringFileName.empty())
- ucr::toUTF8(paths::FindFileName(szTest), compStringFileName);
- if ((*iter)->regexp.match((*iter)->_fileNameOnly ? compStringFileName : compString, 0, match) > 0)
+ if ((*iter)->regexp.match(compString, 0, match) > 0)
return true;
}
catch (...)
nCompMethod = CMP_BINARY_CONTENT;
}
else if (m_pCtxt->m_bEnableImageCompare && (
- di.diffFileInfo[0].size != DirItem::FILE_SIZE_NONE && m_pCtxt->m_pImgfileFilter->includeFile(
- paths::ConcatPath(di.diffFileInfo[0].path, di.diffFileInfo[0].filename)) ||
- di.diffFileInfo[1].size != DirItem::FILE_SIZE_NONE && m_pCtxt->m_pImgfileFilter->includeFile(
- paths::ConcatPath(di.diffFileInfo[1].path, di.diffFileInfo[1].filename)) ||
- nDirs > 2 && di.diffFileInfo[2].size != DirItem::FILE_SIZE_NONE && m_pCtxt->m_pImgfileFilter->includeFile(
- paths::ConcatPath(di.diffFileInfo[2].path, di.diffFileInfo[2].filename))))
+ di.diffFileInfo[0].size != DirItem::FILE_SIZE_NONE && m_pCtxt->m_pImgfileFilter->includeFile(di.diffFileInfo[0].filename) ||
+ di.diffFileInfo[1].size != DirItem::FILE_SIZE_NONE && m_pCtxt->m_pImgfileFilter->includeFile(di.diffFileInfo[1].filename) ||
+ nDirs > 2 && di.diffFileInfo[2].size != DirItem::FILE_SIZE_NONE && m_pCtxt->m_pImgfileFilter->includeFile(di.diffFileInfo[2].filename)))
{
nCompMethod = CMP_IMAGE_CONTENT;
}
re_opts |= RegularExpression::RE_UTF8;
try
{
- m_filters.emplace_back(std::make_shared<FileFilterElement>(regexString, re_opts, true));
+ m_filters.emplace_back(std::make_shared<FileFilterElement>(regexString, re_opts));
}
catch (...)
{