Janitor issues

* Remove obsolete code
* Fix path modification of a relative folder
Replace start token '.' with file path to the project file to make sure that the path './wells/a-1h.dev' can be imported correctly.
* Add more logging when keywords are missing from import
This commit is contained in:
Magne Sjaastad
2023-02-15 07:56:17 +01:00
parent 9099919bbc
commit 48469f33f6
16 changed files with 29 additions and 117 deletions

View File

@@ -473,38 +473,18 @@ void RimProject::setProjectFileNameAndUpdateDependencies( const QString& project
bool foundFile = false;
std::vector<QString> searchedPaths;
QString filePathCandidate = filePath->path();
if ( filePathCandidate.startsWith( '.' ) )
{
filePathCandidate = filePathCandidate.right( filePathCandidate.size() - 1 );
filePathCandidate = newProjectPath + filePathCandidate;
}
QString newFilePath =
RimTools::relocateFile( filePath->path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
RimTools::relocateFile( filePathCandidate, newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
filePath->setPath( newFilePath );
}
// Update path to well path file cache
for ( RimOilField* oilField : oilFields )
{
if ( oilField == nullptr ) continue;
if ( oilField->wellPathCollection() != nullptr )
{
oilField->wellPathCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
if ( oilField->formationNamesCollection() != nullptr )
{
oilField->formationNamesCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
CVF_ASSERT( oilField->fractureDefinitionCollection() );
oilField->fractureDefinitionCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
{
std::vector<RimWellLogFile*> rimWellLogFiles;
this->descendantsIncludingThisOfType( rimWellLogFiles );
for ( auto rimWellLogFile : rimWellLogFiles )
{
rimWellLogFile->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
}
wellPathImport->updateFilePaths();
}