Skip to content

Commit a6391d7

Browse files
committed
use QgsFileUtils::ensureFileNameHasExtension instead
1 parent 0e9af79 commit a6391d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/qgsrasterlayerproperties.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include "qgshillshaderendererwidget.h"
5757
#include "qgssettings.h"
5858
#include "qgsmaplayerlegend.h"
59+
#include "qgsfileutils.h"
5960

6061
#include <QDesktopServices>
6162
#include <QTableWidgetItem>
@@ -1873,8 +1874,7 @@ void QgsRasterLayerProperties::saveStyleAs_clicked()
18731874
type = StyleType::SLD;
18741875
else
18751876
// ensure the user never omits the extension from the file name
1876-
if ( !outputFileName.endsWith( QLatin1String( ".qml" ), Qt::CaseInsensitive ) )
1877-
outputFileName += QLatin1String( ".qml" );
1877+
outputFileName = QgsFileUtils::ensureFileNameHasExtension( outputFileName, QStringList() << QStringLiteral( "qml" ) );
18781878

18791879
apply(); // make sure the style to save is uptodate
18801880

0 commit comments

Comments
 (0)