mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3421 Text File Export : Open file as text file when required
This commit is contained in:
@@ -59,7 +59,7 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked)
|
|||||||
RiaLogging::info("Starting export of Fishbones well path laterals to : " + completeFilename);
|
RiaLogging::info("Starting export of Fishbones well path laterals to : " + completeFilename);
|
||||||
|
|
||||||
QFile exportFile(completeFilename);
|
QFile exportFile(completeFilename);
|
||||||
if (!exportFile.open(QIODevice::WriteOnly))
|
if (!exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
RiaLogging::error("Could not open the file :\n" + completeFilename);
|
RiaLogging::error("Could not open the file :\n" + completeFilename);
|
||||||
return;
|
return;
|
||||||
|
@@ -145,7 +145,7 @@ void RicExportFishbonesWellSegmentsFeature::exportWellSegments(const RimWellPath
|
|||||||
|
|
||||||
QString filePath = exportFolder.filePath(fileName);
|
QString filePath = exportFolder.filePath(fileName);
|
||||||
QFile exportFile(filePath);
|
QFile exportFile(filePath);
|
||||||
if (!exportFile.open(QIODevice::WriteOnly))
|
if (!exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
RiaLogging::error(QString("Export Well Segments: Could not open the file: %1").arg(filePath));
|
RiaLogging::error(QString("Export Well Segments: Could not open the file: %1").arg(filePath));
|
||||||
return;
|
return;
|
||||||
|
@@ -71,7 +71,7 @@ void RicExportFracturesWellSegmentsFeature::exportWellSegments(const RimWellPath
|
|||||||
|
|
||||||
QString filePath = exportFolder.filePath(fileName);
|
QString filePath = exportFolder.filePath(fileName);
|
||||||
QFile exportFile(filePath);
|
QFile exportFile(filePath);
|
||||||
if (!exportFile.open(QIODevice::WriteOnly))
|
if (!exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
RiaLogging::error(QString("Export Fracture Well Segments: Could not open the file: %1").arg(filePath));
|
RiaLogging::error(QString("Export Fracture Well Segments: Could not open the file: %1").arg(filePath));
|
||||||
return;
|
return;
|
||||||
|
@@ -160,7 +160,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
|
|||||||
QDir(exportSettings.folder).absoluteFilePath("FractureTransmissibilityExportInformation");
|
QDir(exportSettings.folder).absoluteFilePath("FractureTransmissibilityExportInformation");
|
||||||
|
|
||||||
fractureTransmissibilityExportInformationFile.setFileName(fractureTransmisibillityExportInformationPath);
|
fractureTransmissibilityExportInformationFile.setFileName(fractureTransmisibillityExportInformationPath);
|
||||||
if (!fractureTransmissibilityExportInformationFile.open(QIODevice::WriteOnly))
|
if (!fractureTransmissibilityExportInformationFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
RiaLogging::error(QString("Export Completions Data: Could not open the file: %1")
|
RiaLogging::error(QString("Export Completions Data: Could not open the file: %1")
|
||||||
.arg(fractureTransmisibillityExportInformationPath));
|
.arg(fractureTransmisibillityExportInformationPath));
|
||||||
@@ -1091,7 +1091,7 @@ QFilePtr RicWellPathExportCompletionDataFeatureImpl::openFileForExport(const QSt
|
|||||||
|
|
||||||
QString filePath = exportFolder.filePath(fileName);
|
QString filePath = exportFolder.filePath(fileName);
|
||||||
QFilePtr exportFile(new QFile(filePath));
|
QFilePtr exportFile(new QFile(filePath));
|
||||||
if (!exportFile->open(QIODevice::WriteOnly))
|
if (!exportFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
auto errorMessage = QString("Export Completions Data: Could not open the file: %1").arg(filePath);
|
auto errorMessage = QString("Export Completions Data: Could not open the file: %1").arg(filePath);
|
||||||
RiaLogging::error(errorMessage);
|
RiaLogging::error(errorMessage);
|
||||||
|
@@ -74,7 +74,7 @@ void RicExportCarfin::onActionTriggered(bool isChecked)
|
|||||||
{
|
{
|
||||||
QString filePath = exportCarfinObject->exportFileName();
|
QString filePath = exportCarfinObject->exportFileName();
|
||||||
QFile exportFile(filePath);
|
QFile exportFile(filePath);
|
||||||
if (!exportFile.open(QIODevice::WriteOnly))
|
if (!exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
RiaLogging::error(QString("Export CARFIN: Could not open the file: %1").arg(filePath));
|
RiaLogging::error(QString("Export CARFIN: Could not open the file: %1").arg(filePath));
|
||||||
return;
|
return;
|
||||||
|
@@ -191,7 +191,7 @@ void RicExportFaultsFeature::saveFault(QString completeFilename, const RigMainGr
|
|||||||
{
|
{
|
||||||
QFile exportFile(completeFilename);
|
QFile exportFile(completeFilename);
|
||||||
|
|
||||||
if (!exportFile.open(QIODevice::WriteOnly) )
|
if (!exportFile.open(QIODevice::WriteOnly | QIODevice::Text) )
|
||||||
{
|
{
|
||||||
RiaLogging::error("Could not open the file : " + completeFilename);
|
RiaLogging::error("Could not open the file : " + completeFilename);
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ QFilePtr RicExportSelectedWellPathsFeature::openFileForExport(const QString& fol
|
|||||||
|
|
||||||
QString filePath = exportFolder.filePath(fileName);
|
QString filePath = exportFolder.filePath(fileName);
|
||||||
QFilePtr exportFile(new QFile(filePath));
|
QFilePtr exportFile(new QFile(filePath));
|
||||||
if (!exportFile->open(QIODevice::WriteOnly))
|
if (!exportFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
auto errorMessage = QString("Export Well Path: Could not open the file: %1").arg(filePath);
|
auto errorMessage = QString("Export Well Path: Could not open the file: %1").arg(filePath);
|
||||||
RiaLogging::error(errorMessage);
|
RiaLogging::error(errorMessage);
|
||||||
|
@@ -316,7 +316,7 @@ bool VdeFileExporter::writeModelMetaJsonFile(const std::vector<VdeMesh>& meshArr
|
|||||||
QByteArray jsonStr = jsonCodec.encode(jsonModelMeta, prettifyJson).toLatin1();
|
QByteArray jsonStr = jsonCodec.encode(jsonModelMeta, prettifyJson).toLatin1();
|
||||||
|
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
if (!file.open(QIODevice::WriteOnly))
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
void writeTextToFile(const QString& filePath, const QString& text)
|
void writeTextToFile(const QString& filePath, const QString& text)
|
||||||
{
|
{
|
||||||
QFile exportFile(filePath);
|
QFile exportFile(filePath);
|
||||||
if (exportFile.open(QIODevice::WriteOnly))
|
if (exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
QTextStream stream(&exportFile);
|
QTextStream stream(&exportFile);
|
||||||
|
|
||||||
|
@@ -60,7 +60,7 @@ PdmDocument::PdmDocument()
|
|||||||
void PdmDocument::readFile()
|
void PdmDocument::readFile()
|
||||||
{
|
{
|
||||||
QFile xmlFile(fileName);
|
QFile xmlFile(fileName);
|
||||||
if (!xmlFile.open(QIODevice::ReadOnly ))
|
if (!xmlFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
readFile(&xmlFile);
|
readFile(&xmlFile);
|
||||||
@@ -101,7 +101,7 @@ void PdmDocument::readFile(QIODevice* xmlFile)
|
|||||||
bool PdmDocument::writeFile()
|
bool PdmDocument::writeFile()
|
||||||
{
|
{
|
||||||
QFile xmlFile(fileName);
|
QFile xmlFile(fileName);
|
||||||
if (!xmlFile.open(QIODevice::WriteOnly ))
|
if (!xmlFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
writeFile(&xmlFile);
|
writeFile(&xmlFile);
|
||||||
|
Reference in New Issue
Block a user