I’m looking more at the asserts in juce_TemporaryFile.cpp and I think the one on line 103 (at the end of TemporaryFile::overwriteTargetFileWithTemporary) shoudl disappear. I can trigger it with this codeint
foo ( File &foo )
{
TemporaryFile temp(foo);
return temp.overwriteTargetFileWithTemporary() ? 1 : 0;
}Even ignoring that weird case, the comment above the assert says// There's no temporary file to use. If your write failed, you should
// probably check, and not bother calling this method. which makes sense, but isn’t possible all the time as far as I can see. For example (and getting back to the topic of this thread), XmlElement::writeToFile() ends up calling operator<< on OutputStream where it’s not possible to detect a write error at the moment.
The assert at the end of the TemporaryFile destructor fires only if 5 delete operations fail. This is definitely possible so in theory it should disappear as well but until an error during delete throws an exception I figure the assert (and possibly a log message) is the only way to notify someone that something went wrong.
