Skip to content
Permalink
Browse files

[ui] fix extension added to raster save as vrt's chosen directory

  • Loading branch information
nirvn committed Jul 2, 2018
1 parent a9f253c commit 648089e7c5977caf691288639b12060d3b42cc00
Showing with 15 additions and 11 deletions.
  1. +15 −11 src/gui/qgsrasterlayersaveasdialog.cpp
@@ -358,19 +358,23 @@ bool QgsRasterLayerSaveAsDialog::addToCanvas() const

QString QgsRasterLayerSaveAsDialog::outputFileName() const
{
QStringList extensions = QgsRasterFileWriter::extensionsForFormat( outputFormat() );
QString defaultExt;
if ( !extensions.empty() )
{
defaultExt = extensions.at( 0 );
}

// ensure the user never omits the extension from the file name
QString fileName = mFilename->filePath();
QFileInfo fi( fileName );
if ( !fileName.isEmpty() && fi.suffix().isEmpty() )

if ( mFilename->storageMode() != QgsFileWidget::GetDirectory )
{
fileName += '.' + defaultExt;
QStringList extensions = QgsRasterFileWriter::extensionsForFormat( outputFormat() );
QString defaultExt;
if ( !extensions.empty() )
{
defaultExt = extensions.at( 0 );
}

// ensure the user never omits the extension from the file name
QFileInfo fi( fileName );
if ( !fileName.isEmpty() && fi.suffix().isEmpty() )
{
fileName += '.' + defaultExt;
}
}

return fileName;

0 comments on commit 648089e

Please sign in to comment.
You can’t perform that action at this time.