#1793 Ensure case name is included in filename when exporting well segments

This commit is contained in:
Bjørnar Grip Fjær 2017-08-29 09:39:33 +02:00
parent 2a5a03bc93
commit d5e8e85bea

View File

@ -38,6 +38,7 @@
#include "cafSelectionManager.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafUtils.h"
#include "cvfMath.h"
@ -157,15 +158,17 @@ bool RicExportFishbonesWellSegmentsFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicExportFishbonesWellSegmentsFeature::exportWellSegments(const RimWellPath* wellPath, const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs, const RicCaseAndFileExportSettingsUi& settings)
{
QString filePath = QDir(settings.folder()).filePath("Welsegs");
QFile exportFile(filePath);
if (settings.caseToApply() == nullptr)
{
RiaLogging::error("Export Well Segments: Cannot export completions data without specified eclipse case");
return;
}
QString fileName = QString("%1-Welsegs").arg(settings.caseToApply()->caseUserDescription());
fileName = caf::Utils::makeValidFileBasename(fileName);
QString filePath = QDir(settings.folder()).filePath(fileName);
QFile exportFile(filePath);
if (!exportFile.open(QIODevice::WriteOnly))
{
RiaLogging::error(QString("Export Well Segments: Could not open the file: %1").arg(filePath));