mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Update file paths if project file is moved on disk
p4#: 21162
This commit is contained in:
@@ -419,3 +419,40 @@ QString RimInputCase::locationOnDisc() const
|
|||||||
QFileInfo fi(m_gridFileName);
|
QFileInfo fi(m_gridFileName);
|
||||||
return fi.absolutePath();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -64,10 +64,13 @@ public:
|
|||||||
|
|
||||||
virtual QString locationOnDisc() const;
|
virtual QString locationOnDisc() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void initAfterRead();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addFiles(const QStringList& newFileNames);
|
void addFiles(const QStringList& newFileNames);
|
||||||
void removeFiles(const QStringList& obsoleteFileNames);
|
void removeFiles(const QStringList& obsoleteFileNames);
|
||||||
|
|
||||||
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
|
||||||
|
|
||||||
|
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user