pub fn create_file_validated(path: &Path) -> Result<File>
Create or truncate a file only after validating the write path.