mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-30 17:10:19 -05:00
Make sure the ensemble file sets are relocated
Use similar logic as relocation of caf::FilePath. Not possible to reuse code, as RimTools::relocateFile checks if the candidate file is present on the file system.
This commit is contained in:
1 parent
edc9cec0a4
commit
4e66b521f8
5 files changed
+36
-3
No files matched your search
@@ -146,6 +146,14 @@ void RimEnsembleFileSet::findAndSetPathPatternAndRangeString( const QStringList&
|
||||
sendFileSetChangedSignal();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEnsembleFileSet::pathPattern() const
|
||||
{
|
||||
return m_pathPattern;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -45,6 +45,9 @@ public:
|
||||
QStringList createPaths( const QString& extension ) const;
|
||||
void findAndSetPathPatternAndRangeString( const QStringList& filePaths );
|
||||
|
||||
QString pathPattern() const;
|
||||
void setPathPattern( const QString& pathPattern );
|
||||
|
||||
void setNameTemplate( const QString& name );
|
||||
void updateName( const std::set<QString>& existingEnsembleNames );
|
||||
void setUsePathKey1( bool useKey1 );
|
||||
@@ -61,7 +64,6 @@ private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
||||
|
||||
void setPathPattern( const QString& pathPattern );
|
||||
void setRangeString( const QString& rangeString );
|
||||
|
||||
QString ensembleInfo() const;
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimEnsembleFileSetCollection.h"
|
||||
|
||||
#include "RimEnsembleFileSet.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
@@ -79,6 +81,22 @@ void RimEnsembleFileSetCollection::deleteFileSetIfPossible( RimEnsembleFileSet*
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleFileSetCollection::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
for ( auto fileSet : fileSets() )
|
||||
{
|
||||
auto pattern = fileSet->pathPattern();
|
||||
auto updatedPattern = RimTools::relocatePathPattern( pattern, newProjectPath, oldProjectPath );
|
||||
if ( updatedPattern != pattern )
|
||||
{
|
||||
fileSet->setPathPattern( updatedPattern );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -41,6 +41,8 @@ public:
|
||||
void deleteAllFileSets();
|
||||
void deleteFileSetIfPossible( RimEnsembleFileSet* fileSet );
|
||||
|
||||
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
|
||||
|
||||
QList<caf::PdmOptionItemInfo> ensembleFileSetOptions() const;
|
||||
|
||||
void updateFileSetNames();
|
||||
|
||||
Reference in new issue
Block a user