Auto-create directories needed in the RSC writing process.

This change auto-creates directories in the write-resource command,
where the resources have folder names in them. Also, it writes out stuff
in binary mode, so it ... you know, works.