mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
(#791) Update well path filename if project file is relocated
This commit is contained in:
parent
124585b96a
commit
e730e5bf9f
@ -390,7 +390,7 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName
|
||||
{
|
||||
RimOilField* oilField = oilFields[oilFieldIdx];
|
||||
if (oilField == NULL || oilField->wellPathCollection == NULL) continue;
|
||||
oilField->wellPathCollection->updateFilePathsFromProjectPath();
|
||||
oilField->wellPathCollection->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
||||
}
|
||||
|
||||
wellPathImport->updateFilePaths();
|
||||
|
@ -365,13 +365,20 @@ bool RimWellPath::isStoredInCache()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::updateFilePathsFromProjectPath()
|
||||
void RimWellPath::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
||||
{
|
||||
QString newCacheFileName = getCacheFileName();
|
||||
|
||||
if (QFile::exists(newCacheFileName))
|
||||
if (isStoredInCache())
|
||||
{
|
||||
filepath = newCacheFileName;
|
||||
QString newCacheFileName = getCacheFileName();
|
||||
|
||||
if (QFile::exists(newCacheFileName))
|
||||
{
|
||||
filepath = newCacheFileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
filepath = RimTools::relocateFile(filepath(), newProjectPath, oldProjectPath, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
RivWellPathPartMgr* partMgr();
|
||||
|
||||
bool readWellPathFile(QString * errorMessage, RifWellPathAsciiFileReader* asciiReader);
|
||||
void updateFilePathsFromProjectPath();
|
||||
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
||||
|
||||
|
||||
|
||||
|
@ -310,11 +310,11 @@ void RimWellPathCollection::scheduleGeometryRegenAndRedrawViews()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::updateFilePathsFromProjectPath()
|
||||
void RimWellPathCollection::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
||||
{
|
||||
for (size_t wellPathIdx = 0; wellPathIdx < wellPaths.size(); wellPathIdx++)
|
||||
{
|
||||
wellPaths[wellPathIdx]->updateFilePathsFromProjectPath();
|
||||
wellPaths[wellPathIdx]->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
|
||||
|
||||
void scheduleGeometryRegenAndRedrawViews();
|
||||
void updateFilePathsFromProjectPath();
|
||||
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
||||
protected:
|
||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user