diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index 5c5aadcbcd..d3445d3d7b 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -916,8 +916,9 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile( { try { + QFileInfo fi( fileName ); std::shared_ptr exportFile = - RicWellPathExportCompletionsFileTools::openFileForExport( folderName, fileName ); + RicWellPathExportCompletionsFileTools::openFileForExport( folderName, fi.baseName(), fi.suffix() ); std::map> completionsForGrid; completionsForGrid.insert( std::pair>( "", completionsForMainGrid ) ); @@ -938,9 +939,11 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile( { try { - QString lgrFileName = fileName + "_LGR"; + QFileInfo fi( fileName ); + + QString lgrFileName = fi.baseName() + "_LGR"; std::shared_ptr exportFile = - RicWellPathExportCompletionsFileTools::openFileForExport( folderName, lgrFileName ); + RicWellPathExportCompletionsFileTools::openFileForExport( folderName, lgrFileName, fi.suffix() ); exportWellPathFractureReport( eclipseCase, exportFile, wellPathFractureReportItems ); if ( exportWelspec ) diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionsFileTools.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionsFileTools.cpp index f0e9565daf..49319c9843 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionsFileTools.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionsFileTools.cpp @@ -50,7 +50,8 @@ std::shared_ptr RicWellPathExportCompletionsFileTools::openFileForExport( /// //-------------------------------------------------------------------------------------------------- std::shared_ptr RicWellPathExportCompletionsFileTools::openFileForExport( const QString& folderName, - const QString& fileName ) + const QString& fileName, + const QString& suffix ) { QString validFileName = caf::Utils::makeValidFileBasename( fileName ); @@ -68,7 +69,8 @@ std::shared_ptr RicWellPathExportCompletionsFileTools::openFileForExport( } } - QString filePath = exportFolder.filePath( validFileName ); + QString filePath = exportFolder.filePath( validFileName ); + if ( !suffix.isEmpty() ) filePath += "." + suffix; std::shared_ptr exportFile( new QFile( filePath ) ); if ( !exportFile->open( QIODevice::WriteOnly | QIODevice::Text ) ) { @@ -79,6 +81,15 @@ std::shared_ptr RicWellPathExportCompletionsFileTools::openFileForExport( return exportFile; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::shared_ptr RicWellPathExportCompletionsFileTools::openFileForExport( const QString& folderName, + const QString& fileName ) +{ + return openFileForExport( folderName, fileName, "" ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionsFileTools.h b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionsFileTools.h index 34bf9ddea7..8bac2ccfee 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionsFileTools.h +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionsFileTools.h @@ -36,6 +36,8 @@ public: }; static std::shared_ptr openFileForExport( const QString& folderName, const QString& fileName ); + static std::shared_ptr + openFileForExport( const QString& folderName, const QString& fileName, const QString& suffix ); static std::shared_ptr openFileForExport( const QString& fullFileName ); static const RimWellPath* findWellPathFromExportName( const QString& wellNameForExport ); -}; \ No newline at end of file +}; diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index 10838be58d..ede0c6257d 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -55,6 +55,7 @@ #include "RimWellPathValve.h" #include +#include #include @@ -69,18 +70,30 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions( std::shared_ptr unifiedLgrExportFile; if ( exportSettings.fileSplit() == RicExportCompletionDataSettingsUi::UNIFIED_FILE ) { - QString fileName; + { + QString fileName; + QFileInfo fi( exportSettings.customFileName() ); + if ( !exportSettings.customFileName().isEmpty() ) + fileName = fi.baseName() + "_MSW"; + else + fileName = QString( "UnifiedCompletions_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() ); - if ( !exportSettings.customFileName().isEmpty() ) - fileName = exportSettings.customFileName() + "_MSW"; - else - fileName = QString( "UnifiedCompletions_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() ); + unifiedExportFile = + RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, fileName, fi.suffix() ); + } - unifiedExportFile = RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, fileName ); + { + QString lgrFileName; + QFileInfo fi( exportSettings.customFileName() ); + if ( !exportSettings.customFileName().isEmpty() ) + lgrFileName = fi.baseName() + "_LGR_MSW"; + else + lgrFileName = + QString( "UnifiedCompletions_LGR_MSW_%1" ).arg( exportSettings.caseToApply->caseUserDescription() ); - QString lgrFileName = fileName + "_LGR"; - unifiedLgrExportFile = - RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, lgrFileName ); + unifiedLgrExportFile = + RicWellPathExportCompletionsFileTools::openFileForExport( exportSettings.folder, lgrFileName, fi.suffix() ); + } } for ( const auto& wellPath : wellPaths )