Make sure directories exist before writing to them

(cherry picked from commit 982ec11dc91a75235ff76beb4cef83f7fcfd1873)
Generated within the generator...

(cherry picked from commit 1dc1456cb9051b343ee51f020e62cd64a6d830c1)
Better log message when code could not be included

(cherry picked from commit 791141b47c09dd8a1920d754bb357f54a5fd0269)
File names are now absolute

(cherry picked from commit 49d690be3c48a90b95f35b7e38c683e389974277)