Export whole playlist preselects file instead of directory

When using “Export Each Playlist Item”,
then the export dialog pre-selects a file instead of a directory.
That file is never a valid directory, of course.

According to source QDir(directory).absolutePath() should be a directory.
See src/docks/encodedock.cpp line 1576:

      MultiFileExportDialog dialog(tr("Export Each Playlist Item"), MAIN.playlist(),
                                     QDir(directory).absolutePath(), QFileInfo(MAIN.fileName()).completeBaseName(), m_extension, this);

The directory is set beforehand like this:

    QString directory = Settings.encodePath();
    if (!m_extension.isEmpty()) {
        if (!MAIN.fileName().isEmpty()) {
            directory += QString("/%1.%2").arg(QFileInfo(MAIN.fileName()).completeBaseName(), m_extension);
    } else {
        if (!MAIN.fileName().isEmpty()) {
            directory += "/" + QFileInfo(MAIN.fileName()).completeBaseName();

It looks like MAIN.fileName() is appended to variable directory, making it refer to a file instead of a directory.
What is the original purpose of the appending?

The purpose of it is to base the export file name on the project name. No plans to change this, and you have not really stated what is the problem (I don’t need you repeat yourself). Not all code paths use the MultiFileExportDialog.

Problem: I need to perform a useless click in the export dialog.
The field for export directory should have a directory pre-selected, but it has a file pre-selected. I need to open the directory selector and close it again.

The MultiFileExportDialog could remove the filename by itself, or the code path leading to the dialog can be disentangled.

This is fixed for the next version 24.01.

1 Like