the portion of code that checks for a file name without extension is AFTER any warning concerning overwriting.
So, if FileBasedDocument::fileExtension is ‘.txt’, the user enters ‘dummy’ as the file name and a file ‘dummy.txt’ already exists, it is overwritten without any warning.
Moreover, I believe that it would be better to append, and not substitute, the default document extension to the name entered by the user.
Finally, the extension management could be improved. The document should have the chance to save data in different formats, hence the need to manage more than a single extension.
But I like JUCE anyway!