Improve performance of checking path extension

This commit is contained in:
Vladimir Golovnev (Glassez) 2022-02-14 11:47:29 +03:00
parent bc94de5626
commit 293479a1f2
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
2 changed files with 4 additions and 2 deletions

View file

@ -155,7 +155,9 @@ QString Path::extension() const
bool Path::hasExtension(const QString &ext) const
{
return (extension().compare(ext, Qt::CaseInsensitive) == 0);
Q_ASSERT(ext.startsWith(QLatin1Char('.')));
return m_pathStr.endsWith(ext, Qt::CaseInsensitive);
}
bool Path::hasAncestor(const Path &other) const