Commit a5211130 authored by Kai Koehne's avatar Kai Koehne
Browse files

FileInProjectFinder: Normalize project directory before checking for changes

Change-Id: Ia6ee0b0f8110add4a54bd470831d457dbb17c9c9
Reviewed-on: http://codereview.qt-project.org/6439


Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarAurindam Jana <aurindam.jana@nokia.com>
parent 8c8f5270
......@@ -60,18 +60,26 @@ FileInProjectFinder::FileInProjectFinder()
{
}
static QString stripTrailingSlashes(const QString &path)
{
QString newPath = path;
while (newPath.endsWith(QLatin1Char('/')))
newPath.remove(newPath.length() - 1, 1);
return newPath;
}
void FileInProjectFinder::setProjectDirectory(const QString &absoluteProjectPath)
{
QTC_ASSERT(QFileInfo(absoluteProjectPath).exists()
&& QFileInfo(absoluteProjectPath).isAbsolute(), return);
const QString newProjectPath = stripTrailingSlashes(absoluteProjectPath);
if (absoluteProjectPath == m_projectDir)
if (newProjectPath == m_projectDir)
return;
m_projectDir = absoluteProjectPath;
while (m_projectDir.endsWith(QLatin1Char('/')))
m_projectDir.remove(m_projectDir.length() - 1, 1);
const QFileInfo infoPath(newProjectPath);
QTC_CHECK(newProjectPath.isEmpty()
|| infoPath.exists() && infoPath.isAbsolute());
m_projectDir = newProjectPath;
m_cache.clear();
}
......@@ -82,6 +90,9 @@ QString FileInProjectFinder::projectDirectory() const
void FileInProjectFinder::setProjectFiles(const QStringList &projectFiles)
{
if (m_projectFiles == projectFiles)
return;
m_projectFiles = projectFiles;
m_cache.clear();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment