From 7bf50ed984a8e8056cac433c98b417b0d2afe1ec Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Mon, 30 Jul 2018 19:45:46 -0700 Subject: [PATCH] Add file extension if needed --- src/QmlControls/ParameterEditorController.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/QmlControls/ParameterEditorController.cc b/src/QmlControls/ParameterEditorController.cc index 2f980a227..f3fb52439 100644 --- a/src/QmlControls/ParameterEditorController.cc +++ b/src/QmlControls/ParameterEditorController.cc @@ -98,10 +98,15 @@ void ParameterEditorController::clearRCToParam(void) void ParameterEditorController::saveToFile(const QString& filename) { if (!filename.isEmpty()) { - QFile file(filename); + QString parameterFilename = filename; + if (!QFileInfo(filename).fileName().contains(".")) { + parameterFilename += QString(".%1").arg(AppSettings::parameterFileExtension); + } + + QFile file(parameterFilename); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qgcApp()->showMessage(tr("Unable to create file: %1").arg(filename)); + qgcApp()->showMessage(tr("Unable to create file: %1").arg(parameterFilename)); return; } -- 2.22.0