Separated writing file.

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>
Added prefix.

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>