Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1398,13 +1398,14 @@ void Song::exportProject( bool multiExport )
efd.setWindowTitle( tr( "Select file for project-export..." ) );
}

QString suffix = "wav";
efd.setDefaultSuffix( suffix );
efd.setAcceptMode( FileDialog::AcceptSave );


if( efd.exec() == QDialog::Accepted && !efd.selectedFiles().isEmpty() &&
!efd.selectedFiles()[0].isEmpty() )
{
QString suffix = "";

QString exportFileName = efd.selectedFiles()[0];
if ( !multiExport )
{
Expand All @@ -1416,19 +1417,18 @@ void Song::exportProject( bool multiExport )
// 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();
exportFileName.remove( "." + suffix );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two observations about remove(...)...

  1. By defaul it's case insensitive by default which can cause issues on Mac and Windows, since they're both case-insensitive (yes, Mac is too!)
  2. This will remove all instances of e.g. .wav, so there are some edge cases where my.wav.file.wav might get snagged, no?

if ( efd.selectedFiles()[0].endsWith( suffix ) )
{
suffix = "";
if( VersionedSaveDialog::fileExistsQuery( exportFileName + suffix,
tr( "Save project" ) ) )
{
exportFileName += suffix;
}
}
}
}

if( VersionedSaveDialog::fileExistsQuery( exportFileName + suffix,
tr( "Save project" ) ) )
{
exportFileName += suffix;
}

ExportProjectDialog epd( exportFileName, gui->mainWindow(), multiExport );
epd.exec();
}
Expand Down