Browse Source

Clean-up the temporary file if the file chooser was canceled or failed

tags/2021-05-28
hogliux 8 years ago
parent
commit
9e74c7ce6b
1 changed files with 14 additions and 7 deletions
  1. +14
    -7
      modules/juce_gui_basics/filebrowser/juce_FileChooser.cpp

+ 14
- 7
modules/juce_gui_basics/filebrowser/juce_FileChooser.cpp View File

@@ -263,14 +263,21 @@ void FileChooser::finished (const Array<URL>& asyncResults, bool shouldMove)
results = asyncResults;
if (shouldMove && fileToSave.existsAsFile() && results.size() > 0)
if (shouldMove && fileToSave.existsAsFile())
{
// The user either selected multiple files or wants to save the file to a URL
// Both are not supported
jassert (results.size() == 1 && results.getReference (0).isLocalFile());
if (! fileToSave.moveFileTo (results.getReference (0).getLocalFile()))
results.clear();
if (results.size() > 0)
{
// The user either selected multiple files or wants to save the file to a URL
// Both are not supported
jassert (results.size() == 1 && results.getReference (0).isLocalFile());
if (! fileToSave.moveFileTo (results.getReference (0).getLocalFile()))
results.clear();
}
else
{
fileToSave.deleteFile();
}
}
pimpl = nullptr;


Loading…
Cancel
Save