diff --git a/src/core/song.cpp b/src/core/song.cpp index 5f3719a8a..0d8eaac44 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -1195,12 +1195,28 @@ void song::exportProject(bool multiExport) efd.setAcceptMode( FileDialog::AcceptSave ); - if( efd.exec() == QDialog::Accepted && - !efd.selectedFiles().isEmpty() && !efd.selectedFiles()[0].isEmpty() ) + if( efd.exec() == QDialog::Accepted && !efd.selectedFiles().isEmpty() && !efd.selectedFiles()[0].isEmpty() ) { - const QString export_file_name = efd.selectedFiles()[0]; - exportProjectDialog epd( export_file_name, - engine::mainWindow(), multiExport ); + QString suffix = ""; + if ( !multiExport ) + { + int stx = efd.selectedNameFilter().indexOf( "(*." ); + int etx = efd.selectedNameFilter().indexOf( ")" ); + + if ( stx > 0 && etx > stx ) + { + // Get first extension from selected dropdown. + // i.e. ".wav" from "WAV-File (*.wav), Dummy-File (*.dum)" + suffix = efd.selectedNameFilter().mid( stx + 2, etx - stx - 2 ).split( " " )[0].trimmed(); + if ( efd.selectedFiles()[0].endsWith( suffix ) ) + { + suffix = ""; + } + } + } + + const QString export_file_name = efd.selectedFiles()[0] + suffix; + exportProjectDialog epd( export_file_name, engine::mainWindow(), multiExport ); epd.exec(); } }