mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 23:23:01 -06:00
Update file paths if project file is moved on disk
p4#: 21162
This commit is contained in:
parent
4ae9182fc6
commit
775b9e5bee
@ -419,3 +419,40 @@ QString RimInputCase::locationOnDisc() const
|
||||
QFileInfo fi(m_gridFileName);
|
||||
return fi.absolutePath();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimInputCase::initAfterRead()
|
||||
{
|
||||
RimCase::initAfterRead();
|
||||
|
||||
QString projPath = RiaApplication::instance()->project()->projectPath();
|
||||
|
||||
QString candidate;
|
||||
|
||||
if (!QFile::exists(m_gridFileName))
|
||||
{
|
||||
QString fileNameWithoutPath = QFileInfo(m_gridFileName).fileName();
|
||||
candidate = QDir::fromNativeSeparators(projPath + QDir::separator() + fileNameWithoutPath);
|
||||
if (QFile::exists(candidate))
|
||||
{
|
||||
m_gridFileName = candidate;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_additionalFileNames().size(); i++)
|
||||
{
|
||||
QString additionalFileName = m_additionalFileNames()[i];
|
||||
|
||||
if (!QFile::exists(additionalFileName))
|
||||
{
|
||||
QString fileNameWithoutPath = QFileInfo(additionalFileName).fileName();
|
||||
candidate = QDir::fromNativeSeparators(projPath + QDir::separator() + fileNameWithoutPath);
|
||||
if (QFile::exists(candidate))
|
||||
{
|
||||
m_additionalFileNames.v()[i] = candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,23 +51,26 @@ public:
|
||||
caf::PdmField<RimInputPropertyCollection*> m_inputPropertyCollection;
|
||||
|
||||
// File open methods
|
||||
void openDataFileSet(const QStringList& filenames);
|
||||
void loadAndSyncronizeInputProperties();
|
||||
void openDataFileSet(const QStringList& filenames);
|
||||
void loadAndSyncronizeInputProperties();
|
||||
|
||||
void removeProperty(RimInputProperty* inputProperty);
|
||||
void removeProperty(RimInputProperty* inputProperty);
|
||||
|
||||
// RimCase overrides
|
||||
virtual bool openEclipseGridFile(); // Find grid file among file set. Read, Find read and validate property date. Syncronize child property sets.
|
||||
|
||||
// PdmObject overrides
|
||||
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);
|
||||
|
||||
virtual QString locationOnDisc() const;
|
||||
virtual QString locationOnDisc() const;
|
||||
|
||||
protected:
|
||||
virtual void initAfterRead();
|
||||
|
||||
private:
|
||||
void addFiles(const QStringList& newFileNames);
|
||||
void removeFiles(const QStringList& obsoleteFileNames);
|
||||
void addFiles(const QStringList& newFileNames);
|
||||
void removeFiles(const QStringList& obsoleteFileNames);
|
||||
|
||||
|
||||
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user