GUI: Use rootpath from Project file.
If rootpath is given in project file then use it as a current directory. Also check if paths given in project file are relative and use rootpath as base path for relative paths.
This commit is contained in:
parent
d967151c32
commit
2f063ad775
|
@ -711,10 +711,28 @@ void MainWindow::OpenProjectFile()
|
||||||
mUI.mActionEditProjectFile->setEnabled(true);
|
mUI.mActionEditProjectFile->setEnabled(true);
|
||||||
mProject = new Project(filepath, this);
|
mProject = new Project(filepath, this);
|
||||||
mProject->Open();
|
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 (rootpath.isEmpty() || rootpath == ".")
|
||||||
|
mCurrentDirectory = inf.canonicalPath();
|
||||||
|
else
|
||||||
|
mCurrentDirectory = rootpath;
|
||||||
|
|
||||||
QStringList paths = mProject->GetProjectFile()->GetCheckPaths();
|
QStringList paths = mProject->GetProjectFile()->GetCheckPaths();
|
||||||
if (!paths.isEmpty())
|
if (!paths.isEmpty())
|
||||||
{
|
{
|
||||||
mCurrentDirectory = paths[0];
|
for (int i = 0; i < paths.size(); i++)
|
||||||
|
{
|
||||||
|
if (!QDir::isAbsolutePath(paths[i]))
|
||||||
|
{
|
||||||
|
QString path = mCurrentDirectory + "/";
|
||||||
|
path += paths[i];
|
||||||
|
paths[i] = QDir::cleanPath(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DoCheckFiles(paths);
|
DoCheckFiles(paths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue