setLastDocumentOpened should set filename with extension
[code]FileBasedDocument::SaveResult FileBasedDocument::saveAsInteractive (const bool warnAboutOverwritingExistingFiles)
{
File f;
if (documentFile.existsAsFile())
f = documentFile;
else
f = getLastDocumentOpened();
String legalFilename (File::createLegalFileName (getDocumentTitle()));
if (legalFilename.isEmpty())
legalFilename = "unnamed";
if (f.existsAsFile() || f.getParentDirectory().isDirectory())
f = f.getSiblingFile (legalFilename);
else
f = File::getSpecialLocation (File::userDocumentsDirectory).getChildFile (legalFilename);
f = f.withFileExtension (fileExtension)
.getNonexistentSibling (true);
FileChooser fc (saveFileDialogTitle, f, fileWildcard);
if (fc.browseForFileToSave (warnAboutOverwritingExistingFiles))
{
//delete setLastDocumentOpened (fc.getResult()); ---------------------------------
File chosen (fc.getResult());
if (chosen.getFileExtension().isEmpty())
{
chosen = chosen.withFileExtension (fileExtension);
if (chosen.exists())
{
if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon,
TRANS("File already exists"),
TRANS("There's already a file called:")
+ "\n\n" + chosen.getFullPathName()
+ "\n\n" + TRANS("Are you sure you want to overwrite it?"),
TRANS("overwrite"),
TRANS("cancel")))
{
return userCancelledSave;
}
}
}
/* add*/ setLastDocumentOpened (chosen); //----------------------------------[/code]