You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
260B

  1. use std::io::prelude::*;
  2. use std::fs::{File};
  3. use std::path::Path;
  4. use errors::Result;
  5. pub fn create_file<P: AsRef<Path>>(path: P, content: &str) -> Result<()> {
  6. let mut file = File::create(&path)?;
  7. file.write_all(content.as_bytes())?;
  8. Ok(())
  9. }