forked from qt-creator/qt-creator
GenericProject: Use Utils::FileName for childOf check
Using startsWith is wrong Change-Id: Ib54c62006994e0657576845066ce8ba9d15d2138 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -94,14 +94,14 @@ void GenericProjectNode::refresh()
|
||||
|
||||
foreach (const QString &absoluteFileName, files) {
|
||||
QFileInfo fileInfo(absoluteFileName);
|
||||
const QString absoluteFilePath = fileInfo.path();
|
||||
Utils::FileName absoluteFilePath = Utils::FileName::fromString(fileInfo.path());
|
||||
QString relativeFilePath;
|
||||
|
||||
if (absoluteFilePath.startsWith(base)) {
|
||||
relativeFilePath = absoluteFilePath.mid(base.length() + 1);
|
||||
if (absoluteFilePath.isChildOf(baseDir)) {
|
||||
relativeFilePath = absoluteFilePath.relativeChildPath(Utils::FileName::fromString(base)).toString();
|
||||
} else {
|
||||
// `file' is not part of the project.
|
||||
relativeFilePath = baseDir.relativeFilePath(absoluteFilePath);
|
||||
relativeFilePath = baseDir.relativeFilePath(absoluteFilePath.toString());
|
||||
}
|
||||
|
||||
if (! filePaths.contains(relativeFilePath))
|
||||
|
||||
Reference in New Issue
Block a user