mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix import of well paths and well log files from Python when the folder is not provided
This commit is contained in:
@@ -71,21 +71,32 @@ RicfCommandResponse RicImportWellPaths::execute()
|
||||
QStringList errorMessages, warningMessages;
|
||||
QStringList wellPathFiles;
|
||||
|
||||
QDir wellPathFolder( m_wellPathFolder );
|
||||
|
||||
if ( wellPathFolder.exists() )
|
||||
QDir wellPathDir;
|
||||
if ( m_wellPathFolder().isEmpty() )
|
||||
{
|
||||
QStringList nameFilters;
|
||||
nameFilters << RicImportWellPaths::wellPathNameFilters();
|
||||
QStringList relativePaths = wellPathFolder.entryList( nameFilters, QDir::Files | QDir::NoDotAndDotDot );
|
||||
for ( QString relativePath : relativePaths )
|
||||
{
|
||||
wellPathFiles.push_back( wellPathFolder.absoluteFilePath( relativePath ) );
|
||||
}
|
||||
wellPathDir = QDir( RiaApplication::instance()->startDir() );
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << ( m_wellPathFolder() + " does not exist" );
|
||||
wellPathDir = QDir( m_wellPathFolder );
|
||||
}
|
||||
|
||||
if ( !m_wellPathFolder().isEmpty() )
|
||||
{
|
||||
if ( wellPathDir.exists() )
|
||||
{
|
||||
QStringList nameFilters;
|
||||
nameFilters << RicImportWellPaths::wellPathNameFilters();
|
||||
QStringList relativePaths = wellPathDir.entryList( nameFilters, QDir::Files | QDir::NoDotAndDotDot );
|
||||
for ( QString relativePath : relativePaths )
|
||||
{
|
||||
wellPathFiles.push_back( wellPathDir.absoluteFilePath( relativePath ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << ( wellPathDir.absolutePath() + " does not exist" );
|
||||
}
|
||||
}
|
||||
|
||||
for ( QString wellPathFile : m_wellPathFiles() )
|
||||
@@ -94,6 +105,10 @@ RicfCommandResponse RicImportWellPaths::execute()
|
||||
{
|
||||
wellPathFiles.push_back( wellPathFile );
|
||||
}
|
||||
else if ( QFileInfo::exists( wellPathDir.absoluteFilePath( wellPathFile ) ) )
|
||||
{
|
||||
wellPathFiles.push_back( wellPathDir.absoluteFilePath( wellPathFile ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << ( wellPathFile + " does not exist" );
|
||||
|
||||
Reference in New Issue
Block a user