I’m using the fileChooser to save a snapshot of my plugin to a .png file.
When I call browseFileForSave() the first time to write a new file the dialog box works fine, but when call that method the next time the file that I previously saved does not appear in the dialog box, so I type in the same filename again and the dialog box asked me if I want to overwrite that old file (so obviously fileChooser is aware that a file with the same name and extension exists!, but somehow does not show it). I chose to overwrite, but that file did not get overwritten.
Here’s the code
FileChooser fc (T("Set file name and directory."), File::nonexistent, T(".png"), true);
if (fc.browseForFileToSave (true))
{
File imageFile(fc.getResult());
PNGImageFormat imageFormatter;
FileOutputStream outputFileStream(imageFile);
Rectangle snapshotArea(0, 0, getWidth(), getHeight());
Image* snapshotImage = createComponentSnapshot (snapshotArea, true);
imageFormatter.writeImageToStream (*snapshotImage, outputFileStream);
deleteAndZero (snapshotImage);
}
Hope that makes it clear