()
| 7 | use std::path::PathBuf; |
| 8 | |
| 9 | pub fn create_profile_folder() -> Result<PathBuf> { |
| 10 | let folder_name = format!( |
| 11 | "profile.{}.out", |
| 12 | Alphanumeric.sample_string(&mut rand::rng(), 10) |
| 13 | ); |
| 14 | let mut folder_path = env::temp_dir(); |
| 15 | folder_path.push(folder_name); |
| 16 | fs::create_dir_all(&folder_path).map_err(|e| { |
| 17 | anyhow!( |
| 18 | "Failed to create profile folder: {}, {}", |
| 19 | folder_path.display(), |
| 20 | e |
| 21 | ) |
| 22 | })?; |
| 23 | debug!("Created profile folder: {}", folder_path.display()); |
| 24 | Ok(folder_path) |
| 25 | } |
| 26 | |
| 27 | #[cfg(test)] |
| 28 | mod tests { |
no outgoing calls