GUI: Handle missing checked paths in project file.

If the project file does not define paths to check then check the
project root directory (which likely is the directory where the
project file is located).

Ticket #2816 (GUI regression: Interrupted checking because of too many #ifdef configurations.)
This commit is contained in:
Kimmo Varis 2011-06-07 14:29:59 +03:00
parent 5a27552669
commit faa1354445
1 changed files with 21 additions and 13 deletions

View File

@ -796,16 +796,25 @@ void MainWindow::LoadProjectFile(const QString &filePath)
mProject->Open();
QString rootpath = mProject->GetProjectFile()->GetRootPath();
// If root path not give or "current dir" then use project file's directory
// as check path
// If the root path is not given or is not "current dir", use project
// file's location directory as root path
if (rootpath.isEmpty() || rootpath == ".")
mCurrentDirectory = inf.canonicalPath();
else
mCurrentDirectory = rootpath;
QStringList paths = mProject->GetProjectFile()->GetCheckPaths();
if (!paths.isEmpty())
// If paths not given then check the root path (which may be the project
// file's location, see above). This is to keep the compatibility with
// old "silent" project file loading when we checked the director where the
// project file was located.
if (paths.isEmpty())
{
paths << mCurrentDirectory;
}
// Convert relative paths to absolute paths
for (int i = 0; i < paths.size(); i++)
{
if (!QDir::isAbsolutePath(paths[i]))
@ -817,7 +826,6 @@ void MainWindow::LoadProjectFile(const QString &filePath)
}
DoCheckFiles(paths);
}
}
void MainWindow::NewProjectFile()
{