From 86be227dee12b1a2d7dafc3308597f1566ef950f Mon Sep 17 00:00:00 2001 From: azakir Date: Thu, 17 Dec 2020 16:18:49 +0100 Subject: [PATCH] change default med file out --- src/SMESHGUI/MG_ADAPTGUI.cxx | 9 +++++++-- src/SMESHGUI/MG_ADAPTGUI.hxx | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SMESHGUI/MG_ADAPTGUI.cxx b/src/SMESHGUI/MG_ADAPTGUI.cxx index 928b93023..397bdb3be 100644 --- a/src/SMESHGUI/MG_ADAPTGUI.cxx +++ b/src/SMESHGUI/MG_ADAPTGUI.cxx @@ -764,7 +764,8 @@ void SMESHGUI_MgAdaptArguments::onSelectMedFilebuttonClicked() *myFileInDir = myFileInfo.path(); *myFileOutDir = myFileInfo.path(); selectMedFileLineEdit->setText(myFileInfo.fileName()); - selectOutMedFileLineEdit->setText(myFileInfo.fileName()); + QString outF = QString( remove_extension(myFileInfo.fileName().toStdString() ).c_str() )+QString(".adapt.med"); + selectOutMedFileLineEdit->setText(outF); onLocalSelected(myFileInfo.filePath()); } @@ -1368,6 +1369,10 @@ std::map GetListeChamps(QString aFile, bool errorMessage) return ListeChamp; } - +std::string remove_extension(const std::string& filename) { + size_t lastdot = filename.find_last_of("."); + if (lastdot == std::string::npos) return filename; + return filename.substr(0, lastdot); +} diff --git a/src/SMESHGUI/MG_ADAPTGUI.hxx b/src/SMESHGUI/MG_ADAPTGUI.hxx index ced54d236..4cc94cca9 100644 --- a/src/SMESHGUI/MG_ADAPTGUI.hxx +++ b/src/SMESHGUI/MG_ADAPTGUI.hxx @@ -97,6 +97,7 @@ std::map GetListeChamps(QString aFile, bool errorMessage = true); QString lireNomMaillage(QString aFile); QString lireNomMaillage2(med_idt medIdt,int meshId); med_idt OuvrirFichier(QString aFile); +std::string remove_extension(const std::string& filename); //================================================================================= // class : SMESHGUI_MgAdaptDlg -- 2.39.2