Commit b53fbe80 authored by con's avatar con
Browse files

Include any changed file when saving before build/run.

Previously there was a lot of logic figuring out which files have
changed that are referenced a project. Leading to e.g. header files that
are part of the project, but not in a pro file, not being saved.
parent 3270c482
......@@ -1290,38 +1290,7 @@ bool ProjectExplorerPlugin::saveModifiedFiles(const QList<Project *> & projects)
if (debug)
qDebug() << "ProjectExplorerPlugin::saveModifiedFiles";
QList<Core::IFile *> modifiedFi = Core::ICore::instance()->fileManager()->modifiedFiles();
QMap<QString, Core::IFile *> modified;
QStringList allFiles;
foreach (Project *pro, projects)
allFiles << allFilesWithDependencies(pro);
// allFiles must be sorted for the algorithm to work
foreach (Core::IFile * fi, modifiedFi)
modified.insert(fi->fileName(), fi);
QList<Core::IFile *> filesToSave;
QMap<QString, Core::IFile *>::const_iterator mit = modified.constBegin();
QStringList::const_iterator ait = allFiles.constBegin();
QMap<QString, Core::IFile *>::const_iterator mend = modified.constEnd();
QStringList::const_iterator aend = allFiles.constEnd();
while (mit != mend && ait != aend) {
if (mit.key() < *ait)
else if (*ait < mit.key())
else {
QList<Core::IFile *> filesToSave = Core::ICore::instance()->fileManager()->modifiedFiles();
if (!filesToSave.isEmpty()) {
if (m_projectExplorerSettings.saveBeforeBuild) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment