Make sure content directories exist before writing files.