Writes `content` to `path`, adding a newline if necessary.
(os: &Os, path: impl AsRef<Path>, mut content: String)
| 565 | |
| 566 | /// Writes `content` to `path`, adding a newline if necessary. |
| 567 | async fn write_to_file(os: &Os, path: impl AsRef<Path>, mut content: String) -> Result<()> { |
| 568 | let path_ref = path.as_ref(); |
| 569 | // Log the path being written to |
| 570 | tracing::debug!("Writing to file: {:?}", path_ref); |
| 571 | |
| 572 | if !content.ends_with_newline() { |
| 573 | content.push('\n'); |
| 574 | } |
| 575 | os.fs.write(path.as_ref(), content).await?; |
| 576 | Ok(()) |
| 577 | } |
| 578 | |
| 579 | /// Returns a prefix/suffix pair before and after the content dictated by `[start_line, end_line]` |
| 580 | /// within `content`. The updated start and end lines containing the original context along with |