forked from qt-creator/qt-creator
Python: preserve sorted state of project files
Change-Id: I77cd9d9bac93a04d0e30beda8541862a1cd5371f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -302,12 +302,21 @@ bool PythonBuildSystem::addFiles(Node *, const FilePaths &filePaths, FilePaths *
|
||||
{
|
||||
const Utils::FilePath projectDir = projectDirectory();
|
||||
|
||||
auto comp = [](const FileEntry &left, const FileEntry &right) {
|
||||
return left.rawEntry < right.rawEntry;
|
||||
};
|
||||
|
||||
const bool isSorted = std::is_sorted(m_files.begin(), m_files.end(), comp);
|
||||
|
||||
for (const FilePath &filePath : filePaths) {
|
||||
if (!projectDir.isSameDevice(filePath))
|
||||
return false;
|
||||
m_files.append(FileEntry{filePath.relativePathFrom(projectDir).toString(), filePath});
|
||||
}
|
||||
|
||||
if (isSorted)
|
||||
std::sort(m_files.begin(), m_files.end(), comp);
|
||||
|
||||
return save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user