mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Always use export folder if defined
Rename to m_customFileNameIncludingPath, and split into folder and file name for export object
This commit is contained in:
@@ -36,6 +36,8 @@
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportWellPathCompletions, "exportWellPathCompletions" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -81,7 +83,7 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_exportDataSourceAsComments, "exportComments", true, "Export Data Source as Comments" );
|
||||
CAF_PDM_InitScriptableField( &m_exportWelspec, "exportWelspec", true, "Export WELSPEC keyword" );
|
||||
CAF_PDM_InitScriptableField( &m_customFileName, "customFileName", QString(), "Custom Filename" );
|
||||
CAF_PDM_InitScriptableField( &m_customFileNameIncludingPath, "customFileName", QString(), "Custom Filename" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -121,7 +123,32 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
||||
|
||||
exportSettings.setExportDataSourceAsComment( m_exportDataSourceAsComments );
|
||||
exportSettings.setExportWelspec( m_exportWelspec );
|
||||
exportSettings.setCustomFileName( m_customFileName );
|
||||
|
||||
QString exportFolderPath;
|
||||
if ( m_customFileNameIncludingPath().isEmpty() )
|
||||
{
|
||||
exportFolderPath =
|
||||
RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::ExportType::COMPLETIONS );
|
||||
if ( exportFolderPath.isNull() )
|
||||
{
|
||||
exportFolderPath = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath( "completions" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QFileInfo fi( m_customFileNameIncludingPath );
|
||||
auto fileName = fi.fileName();
|
||||
|
||||
exportSettings.setCustomFileName( fileName );
|
||||
|
||||
auto pathCandidate = fi.path();
|
||||
if ( pathCandidate.size() > 2 )
|
||||
{
|
||||
exportFolderPath = pathCandidate;
|
||||
}
|
||||
}
|
||||
|
||||
exportSettings.folder = exportFolderPath;
|
||||
|
||||
{
|
||||
auto eclipseCase = TOOLS::caseFromId( m_caseId() );
|
||||
@@ -134,14 +161,6 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
|
||||
exportSettings.caseToApply = eclipseCase;
|
||||
}
|
||||
|
||||
QString exportFolder =
|
||||
RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::ExportType::COMPLETIONS );
|
||||
if ( exportFolder.isNull() )
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath( "completions" );
|
||||
}
|
||||
exportSettings.folder = exportFolder;
|
||||
|
||||
caf::PdmScriptResponse response;
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
@@ -60,7 +60,10 @@ private:
|
||||
caf::PdmField<bool> m_includeFractures;
|
||||
caf::PdmField<bool> m_excludeMainBoreForFishbones;
|
||||
|
||||
caf::PdmField<bool> m_exportDataSourceAsComments;
|
||||
caf::PdmField<bool> m_exportWelspec;
|
||||
caf::PdmField<QString> m_customFileName;
|
||||
caf::PdmField<bool> m_exportDataSourceAsComments;
|
||||
caf::PdmField<bool> m_exportWelspec;
|
||||
|
||||
// This text field can contain a file name, optionally including the full path. When the full path is specified,
|
||||
// the path and file name is split in RicfExportWellPathCompletions::execute()
|
||||
caf::PdmField<QString> m_customFileNameIncludingPath;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user