diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-10-11 15:17:44 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2011-10-12 11:12:22 +0200 |
commit | a5211130f39b0e5bec7ab512c9ff23a23fc71e3a (patch) | |
tree | 720ce1ec80541634d52f89aef9044a70d77942e1 /src/libs/utils | |
parent | 8c8f5270c2e7a53f78eb36e9b1390dedd16f0969 (diff) | |
download | qt-creator-a5211130f39b0e5bec7ab512c9ff23a23fc71e3a.tar.gz |
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: Aurindam Jana <aurindam.jana@nokia.com>
Diffstat (limited to 'src/libs/utils')
-rw-r--r-- | src/libs/utils/fileinprojectfinder.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/libs/utils/fileinprojectfinder.cpp b/src/libs/utils/fileinprojectfinder.cpp index d0f3b82f8c..45c42245d4 100644 --- a/src/libs/utils/fileinprojectfinder.cpp +++ b/src/libs/utils/fileinprojectfinder.cpp @@ -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(); } |