forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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)
|
void FileInProjectFinder::setProjectDirectory(const QString &absoluteProjectPath)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(QFileInfo(absoluteProjectPath).exists()
|
const QString newProjectPath = stripTrailingSlashes(absoluteProjectPath);
|
||||||
&& QFileInfo(absoluteProjectPath).isAbsolute(), return);
|
|
||||||
|
|
||||||
if (absoluteProjectPath == m_projectDir)
|
if (newProjectPath == m_projectDir)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_projectDir = absoluteProjectPath;
|
const QFileInfo infoPath(newProjectPath);
|
||||||
while (m_projectDir.endsWith(QLatin1Char('/')))
|
QTC_CHECK(newProjectPath.isEmpty()
|
||||||
m_projectDir.remove(m_projectDir.length() - 1, 1);
|
|| infoPath.exists() && infoPath.isAbsolute());
|
||||||
|
|
||||||
|
m_projectDir = newProjectPath;
|
||||||
m_cache.clear();
|
m_cache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +90,9 @@ QString FileInProjectFinder::projectDirectory() const
|
|||||||
|
|
||||||
void FileInProjectFinder::setProjectFiles(const QStringList &projectFiles)
|
void FileInProjectFinder::setProjectFiles(const QStringList &projectFiles)
|
||||||
{
|
{
|
||||||
|
if (m_projectFiles == projectFiles)
|
||||||
|
return;
|
||||||
|
|
||||||
m_projectFiles = projectFiles;
|
m_projectFiles = projectFiles;
|
||||||
m_cache.clear();
|
m_cache.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user