aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/python/pythonproject.cpp
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2023-06-12 08:07:14 +0200
committerDavid Schulz <david.schulz@qt.io>2023-06-15 06:16:17 +0000
commit80e66ed1728a4b28cbb85dcd871aaee256298e19 (patch)
tree2b4a156a1cce247e3bd257d5d93fb56daacaab0e /src/plugins/python/pythonproject.cpp
parentc617c2afa1e9e330047c761e35435b919d5de873 (diff)
Python: preserve sorted state of project files
Change-Id: I77cd9d9bac93a04d0e30beda8541862a1cd5371f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/python/pythonproject.cpp')
-rw-r--r--src/plugins/python/pythonproject.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/python/pythonproject.cpp b/src/plugins/python/pythonproject.cpp
index 50ffe379943..c9bb0f0b6ce 100644
--- a/src/plugins/python/pythonproject.cpp
+++ b/src/plugins/python/pythonproject.cpp
@@ -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();
}