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