Expand "~/" while writing file names.