mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#791) Update well path filename if project file is relocated
This commit is contained in:
@@ -390,7 +390,7 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName
|
|||||||
{
|
{
|
||||||
RimOilField* oilField = oilFields[oilFieldIdx];
|
RimOilField* oilField = oilFields[oilFieldIdx];
|
||||||
if (oilField == NULL || oilField->wellPathCollection == NULL) continue;
|
if (oilField == NULL || oilField->wellPathCollection == NULL) continue;
|
||||||
oilField->wellPathCollection->updateFilePathsFromProjectPath();
|
oilField->wellPathCollection->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
wellPathImport->updateFilePaths();
|
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 (isStoredInCache())
|
||||||
|
|
||||||
if (QFile::exists(newCacheFileName))
|
|
||||||
{
|
{
|
||||||
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();
|
RivWellPathPartMgr* partMgr();
|
||||||
|
|
||||||
bool readWellPathFile(QString * errorMessage, RifWellPathAsciiFileReader* asciiReader);
|
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++)
|
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 scheduleGeometryRegenAndRedrawViews();
|
||||||
void updateFilePathsFromProjectPath();
|
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
||||||
protected:
|
protected:
|
||||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user