Index: src/libchcore/TStringPattern.cpp =================================================================== diff -u -r22c7d5559ca17c9b1859d2283b667516b23ac597 -r3401d5079f33b29a7783b65bfad5f34d89a33ba5 --- src/libchcore/TStringPattern.cpp (.../TStringPattern.cpp) (revision 22c7d5559ca17c9b1859d2283b667516b23ac597) +++ src/libchcore/TStringPattern.cpp (.../TStringPattern.cpp) (revision 3401d5079f33b29a7783b65bfad5f34d89a33ba5) @@ -1,3 +1,21 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ #include "stdafx.h" #include "TStringPattern.h" #include @@ -129,9 +147,15 @@ return bMatch; } - bool TStringPattern::Matches(const TString& strTextToMatch) const + bool TStringPattern::Matches(const TSmartPath& pathToMatch) const { - return MatchMask(m_strPattern.c_str(), strTextToMatch.c_str()); + switch(m_ePatternType) + { + case EPatternType::eType_Wildcard: + return MatchMask(m_strPattern.c_str(), pathToMatch.GetFileName().ToString()); + default: + throw std::invalid_argument("Unsupported pattern type"); + } } void TStringPattern::SetPattern(const TString& strPattern, EPatternType ePatternType)