FileBrowserComponent with save and directory

This is a regression from 1.53.

If you create a FileBrowserComponent with saveMode + canSelectDirectories (I.E.an output path for multiple files), the ‘save’ button never becomes available because currentFileIsValid() disallows directory selections for saveMode.

bool FileBrowserComponent::currentFileIsValid() const
{
    if (isSaveMode())
    {
        if (getSelectedFile (0).exists())
        {
            if (canSelectDirectories && getSelectedFile (0).isDirectory())
                return true;
            else if (canSelectFiles) return true;
        }
        return false;
    }
    else
        return getSelectedFile (0).exists();
}

Similarly ‘save’ should be ‘choose’ under this circumstance, so:

String FileBrowserComponent::getActionVerb() const
{
    return isSaveMode() ? canSelectDirectories ? TRANS("Choose") : TRANS("Save") : TRANS("Open");
}

Nice one, thanks!

FYI… your suggestion contained some mistakes (canSelectDirectories is an enum, not a member! and when you’re saving, you shouldn’t return false if the file doesn’t exist). I’ve done what I think you were trying to do, but let me know if it sorts out the problem you were having.

Wow, that was a pretty impressive case of ‘if it compiles ship it’. Sorry Jules! I was doing three (actually literally) things at once in an effort close up stuff ahead of the holiday, and clearly wasn’t paying attention. :oops: