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:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "WellLogCommands/RicWellLogsImportFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimWellLogFile.h"
|
||||
|
||||
#include <QDir>
|
||||
@@ -52,15 +53,24 @@ RicfCommandResponse RicfImportWellLogFiles::execute()
|
||||
QStringList errorMessages, warningMessages;
|
||||
QStringList wellLogFilePaths;
|
||||
|
||||
QDir wellPathFolder( m_wellLogFileFolder );
|
||||
if ( wellPathFolder.exists() )
|
||||
QDir wellLogDir;
|
||||
if ( m_wellLogFileFolder().isEmpty() )
|
||||
{
|
||||
wellLogDir = QDir( RiaApplication::instance()->startDir() );
|
||||
}
|
||||
else
|
||||
{
|
||||
wellLogDir = QDir( m_wellLogFileFolder );
|
||||
}
|
||||
|
||||
if ( !m_wellLogFileFolder().isEmpty() )
|
||||
{
|
||||
QStringList nameFilters;
|
||||
nameFilters << RicWellLogsImportFileFeature::wellLogFileNameFilters();
|
||||
QStringList relativePaths = wellPathFolder.entryList( nameFilters, QDir::Files | QDir::NoDotAndDotDot );
|
||||
QStringList relativePaths = wellLogDir.entryList( nameFilters, QDir::Files | QDir::NoDotAndDotDot );
|
||||
for ( QString relativePath : relativePaths )
|
||||
{
|
||||
wellLogFilePaths.push_back( wellPathFolder.absoluteFilePath( relativePath ) );
|
||||
wellLogFilePaths.push_back( wellLogDir.absoluteFilePath( relativePath ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -74,6 +84,10 @@ RicfCommandResponse RicfImportWellLogFiles::execute()
|
||||
{
|
||||
wellLogFilePaths.push_back( wellLogFilePath );
|
||||
}
|
||||
else if ( QFileInfo::exists( wellLogDir.absoluteFilePath( wellLogFilePath ) ) )
|
||||
{
|
||||
wellLogFilePaths.push_back( wellLogDir.absoluteFilePath( wellLogFilePath ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << ( wellLogFilePath + " doesn't exist" );
|
||||
|
||||
Reference in New Issue
Block a user