(
path_to_file: &Path,
search: &str,
replace: &str,
)
| 31 | const OUTPUT_DIR: &str = "shared"; |
| 32 | |
| 33 | fn search_and_replace( |
| 34 | path_to_file: &Path, |
| 35 | search: &str, |
| 36 | replace: &str, |
| 37 | ) -> Result<(), Box<dyn std::error::Error>> { |
| 38 | let file_content = fs::read_to_string(path_to_file)?; |
| 39 | let new_content = file_content.replace(search, replace); |
| 40 | |
| 41 | let mut file = OpenOptions::new() |
| 42 | .write(true) |
| 43 | .truncate(true) |
| 44 | .open(path_to_file)?; |
| 45 | file.write_all(new_content.as_bytes())?; |
| 46 | |
| 47 | Ok(()) |
| 48 | } |
| 49 | |
| 50 | fn create_root_folder(parent: &Path) -> Result<PathBuf, Box<dyn std::error::Error>> { |
| 51 | let timestamp = SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs(); |
no outgoing calls
no test coverage detected