Detect when project path has changed, and do a explicit update of file path for RimCases.

Do not use initAfterRead
p4#: 21165
This commit is contained in:
Magne Sjaastad
2013-04-08 12:01:40 +02:00
parent 775b9e5bee
commit 64899f62c2
8 changed files with 44 additions and 31 deletions

View File

@@ -234,9 +234,30 @@ void RimProject::insertCaseInCaseGroup(RimIdenticalGridCaseGroup* caseGroup, Rim
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimProject::projectPath() const
void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName)
{
QFileInfo fileInfo(fileName());
return fileInfo.path();
this->fileName = fileName;
// Loop over all reservoirs and update file path
QFileInfo fileInfo(fileName);
QString projectPath = fileInfo.path();
for (size_t i = 0; i < reservoirs.size(); i++)
{
reservoirs[i]->updateFilePathsFromProjectPath(projectPath);
}
// Case groups : Loop over all reservoirs in and update file path
for (size_t i = 0; i < caseGroups.size(); i++)
{
RimIdenticalGridCaseGroup* cg = caseGroups()[i];
for (size_t j = 0; j < cg->caseCollection()->reservoirs().size(); j++)
{
cg->caseCollection()->reservoirs()[j]->updateFilePathsFromProjectPath(projectPath);
}
}
}