Detect when project path has changed, and do a explicit update of file path for RimCases.

Do not use initAfterRead
p4#: 21165
This commit is contained in:
Magne Sjaastad
2013-04-08 12:01:40 +02:00
parent 775b9e5bee
commit 64899f62c2
8 changed files with 44 additions and 31 deletions

View File

@@ -420,21 +420,18 @@ QString RimInputCase::locationOnDisc() const
return fi.absolutePath();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimInputCase::initAfterRead()
void RimInputCase::updateFilePathsFromProjectPath(const QString& projectPath)
{
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);
candidate = QDir::fromNativeSeparators(projectPath + QDir::separator() + fileNameWithoutPath);
if (QFile::exists(candidate))
{
m_gridFileName = candidate;
@@ -448,11 +445,12 @@ void RimInputCase::initAfterRead()
if (!QFile::exists(additionalFileName))
{
QString fileNameWithoutPath = QFileInfo(additionalFileName).fileName();
candidate = QDir::fromNativeSeparators(projPath + QDir::separator() + fileNameWithoutPath);
candidate = QDir::fromNativeSeparators(projectPath + QDir::separator() + fileNameWithoutPath);
if (QFile::exists(candidate))
{
m_additionalFileNames.v()[i] = candidate;
}
}
}
}