Make ofstreams thow exception on write issues
This is related to #5254.
I have observed that if non-existent --cppcheck-build-dir is used, all file writes silently fail.
Should we enable exceptions on std::ofstream(s)?
@chrchr-github can you please rerun the failed check?
Ready for review. A bit bloaty, not sure if all the asserts are needed, maybe I am too defensive. Please note that there are a few TODOs I would like to get reviewed.
In some cases this is by design and would cause existing installations to fail. So this might require a soft deprecation with introducing a warning first in some cases.
Also we should add cli Python tests for each of these to make sure they fail as expected.
We need to make sure we have tests for all these cases. That also needs to consider the issue addressed in https://github.com/danmar/simplecpp/pull/339 i.e. fstream can successfully open directories but just not read from them.