Automatically appending file extension on fileChooser on Android

Hello!!

I’m having an issue when saving a file on Android using fileChooser. It does not get saved as a .wav file unless the user manually types .wav when saving inside fileChooser.

void stop()
    {
        {
            const juce::ScopedLock sl (writerLock);
            activeWriter = nullptr;
            DBG("Stopped");
        }
        threadedWriter.reset();
    }

inline std::unique_ptr<juce::OutputStream> makeOutputStream (const juce::URL& url)
{
    if (const auto doc = juce::AndroidDocument::fromDocument (url))
        return doc.createOutputStream();

#if ! JUCE_IOS
    if (url.isLocalFile())
        return url.getLocalFile().createOutputStream();
#endif

    return url.createOutputStream();
}

    juce::FileChooser chooser { "Output file...", juce::File::getCurrentWorkingDirectory().getChildFile ("recording.wav"), "*.wav" };

    void stopRecording()
    {
        recorder.stop();
        
        chooser.launchAsync (  juce::FileBrowserComponent::saveMode
                               | juce::FileBrowserComponent::canSelectFiles
                               | juce::FileBrowserComponent::warnAboutOverwriting,
                               [this] (const juce::FileChooser& c)
                               {
                                   if (juce::FileInputStream inputStream (lastRecording); inputStream.openedOk())
                                       if (const auto outputStream = makeOutputStream (c.getURLResult()))
                                           outputStream->writeFromInputStream (inputStream, -1);

                                   recordAudioButton.setButtonText ("Record");
                               });
    }

Heya, anyone ? Is this even possible on Android ?