toml::to_file needs to be able to create the save file

This commit is contained in:
Paul Woolcock
2018-08-27 12:09:03 -04:00
parent 1057e58343
commit f8f8054c5c
+1 -1
View File
@@ -60,7 +60,7 @@ pub fn to_writer<W: Write>(data: &Data, writer: W) -> Result<()> {
/// fine-grained control
pub fn to_file<P: AsRef<Path>>(data: &Data, path: P) -> Result<()> {
let mut options = OpenOptions::new();
options.write(true).truncate(true);
options.create(true).write(true).truncate(true);
to_file_with_options(data, path, options)?;
Ok(())
}