mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1444 Reallocate summary case file names when opening project
This commit is contained in:
parent
15d3e08f70
commit
3fc0a59f06
@ -417,20 +417,20 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName
|
||||
}
|
||||
|
||||
// Update path to well path file cache
|
||||
for (size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++)
|
||||
{
|
||||
RimOilField* oilField = oilFields[oilFieldIdx];
|
||||
if (oilField == NULL || oilField->wellPathCollection == NULL) continue;
|
||||
oilField->wellPathCollection->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
||||
}
|
||||
|
||||
for(RimOilField* oilField: oilFields)
|
||||
{
|
||||
if(oilField == NULL) continue;
|
||||
if(oilField->formationNamesCollection() != NULL)
|
||||
if (oilField == NULL) continue;
|
||||
if (oilField->wellPathCollection() != NULL)
|
||||
{
|
||||
oilField->wellPathCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
||||
}
|
||||
if (oilField->formationNamesCollection() != NULL)
|
||||
{
|
||||
oilField->formationNamesCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
||||
}
|
||||
if (oilField->summaryCaseCollection() != NULL) {
|
||||
oilField->summaryCaseCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimFileSummaryCase.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "QFileInfo"
|
||||
|
||||
|
||||
@ -71,3 +73,11 @@ QString RimFileSummaryCase::caseName()
|
||||
|
||||
return caseFileName.completeBaseName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFileSummaryCase::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
|
||||
{
|
||||
m_summaryHeaderFilename = RimTools::relocateFile(m_summaryHeaderFilename(), newProjectPath, oldProjectPath, nullptr, nullptr);
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
void setSummaryHeaderFilename(const QString& fileName);
|
||||
virtual QString summaryHeaderFilename() const override;
|
||||
virtual QString caseName() override;
|
||||
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -154,3 +154,11 @@ QString RimGridSummaryCase::eclipseGridFileName() const
|
||||
return m_eclipseCase()->gridFileName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridSummaryCase::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
|
||||
{
|
||||
// Shouldn't have to do anything
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
|
||||
virtual QString summaryHeaderFilename() const override;
|
||||
virtual QString caseName() override;
|
||||
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) override;
|
||||
|
||||
private:
|
||||
QString eclipseGridFileName() const;
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
void loadCase();
|
||||
RigSummaryCaseData* caseData();
|
||||
|
||||
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) = 0;
|
||||
|
||||
protected:
|
||||
void updateTreeItemName();
|
||||
|
||||
|
@ -264,3 +264,14 @@ QString RimSummaryCaseCollection::uniqueShortNameForCase(RimSummaryCase* summary
|
||||
return shortName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCaseCollection::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
|
||||
{
|
||||
for (auto summaryCase : m_cases)
|
||||
{
|
||||
summaryCase->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,8 @@ public:
|
||||
|
||||
QString uniqueShortNameForCase(RimSummaryCase* summaryCase);
|
||||
|
||||
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user