QmakePM: Do a "sorted insert" when adding files

Don't blindly append to the end of the list, but try to put files into
the right place with regards to lexicographical order.
We do not re-sort existing file lists, nor do we attempt to be fancy
with strangely formatted project files. But lists conforming to our own
style will stay sorted, in particular lists that have only ever been
touched by Qt Creator.

Fixes: QTCREATORBUG-553
Fixes: QTCREATORBUG-21807
Change-Id: I15db0e867a2d477fcf95e008f98ba468dcd83e45
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Christian Kandeler
2019-01-23 17:30:52 +01:00
parent 809416c993
commit a420374976
3 changed files with 69 additions and 16 deletions

View File

@@ -542,6 +542,7 @@ bool QmakePriFile::addFiles(const QStringList &filePaths, QStringList *notAdded)
if (!m_recursiveEnumerateFiles.contains(FileName::fromString(file)))
uniqueFilePaths.append(file);
}
uniqueFilePaths.sort();
changeFiles(type, uniqueFilePaths, &failedFiles, AddToProFile);
if (notAdded)