Fixed codegen

Fixed current codegen to compile with the latest nightly version of Rust.

* Removed unnecessary and deprecated `~` in `get_writer()`
* Switched to `FilePermission` values for `mkdir_recursive`