summaryrefslogtreecommitdiff
path: root/src/libs/utils
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-05-20 13:39:27 +0200
committerhjk <hjk@qt.io>2019-05-20 16:05:46 +0000
commitd8f459d48e40585eb0acfc62f6763d1c3704e699 (patch)
tree5449557fe5791eabc5caae630790fb54b02cb3bf /src/libs/utils
parent0595e67c82d718240d40c1f689a0b3d7923e3590 (diff)
downloadqt-creator-d8f459d48e40585eb0acfc62f6763d1c3704e699.tar.gz
Utils: Make FileName comparison work with URLs
Change-Id: Idfd8623338f3a74250c4bf264579cbb4ec5e70b8 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/utils')
-rw-r--r--src/libs/utils/fileutils.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp
index de7fc358b4..a08212c622 100644
--- a/src/libs/utils/fileutils.cpp
+++ b/src/libs/utils/fileutils.cpp
@@ -800,32 +800,36 @@ QVariant FileName::toVariant() const
bool FileName::operator==(const FileName &other) const
{
+ if (!m_url.isEmpty())
+ return m_url == other.m_url;
return QString::compare(m_data, other.m_data, HostOsInfo::fileNameCaseSensitivity()) == 0;
}
bool FileName::operator!=(const FileName &other) const
{
- return !(m_data == other.m_data);
+ return !(*this == other);
}
bool FileName::operator<(const FileName &other) const
{
+ if (!m_url.isEmpty())
+ return m_url < other.m_url;
return QString::compare(m_data, other.m_data, HostOsInfo::fileNameCaseSensitivity()) < 0;
}
bool FileName::operator<=(const FileName &other) const
{
- return QString::compare(m_data, other.m_data, HostOsInfo::fileNameCaseSensitivity()) <= 0;
+ return !(other < *this);
}
bool FileName::operator>(const FileName &other) const
{
- return other.m_data < m_data;
+ return other < *this;
}
bool FileName::operator>=(const FileName &other) const
{
- return other.m_data <= m_data;
+ return !(*this < other);
}
FileName FileName::operator+(const QString &s) const