saveFile writes A or B edits to file, with no prompting, etc
(ab bool, filename core.Filename)
| 291 | |
| 292 | // saveFile writes A or B edits to file, with no prompting, etc |
| 293 | func (dv *DiffEditor) saveFile(ab bool, filename core.Filename) error { |
| 294 | var txt string |
| 295 | if ab { |
| 296 | txt = strings.Join(dv.diffs.B.Edit, "\n") |
| 297 | } else { |
| 298 | txt = strings.Join(dv.diffs.A.Edit, "\n") |
| 299 | } |
| 300 | err := os.WriteFile(string(filename), []byte(txt), 0644) |
| 301 | if err != nil { |
| 302 | core.ErrorSnackbar(dv, err) |
| 303 | slog.Error(err.Error()) |
| 304 | } |
| 305 | return err |
| 306 | } |
| 307 | |
| 308 | // saveFileA saves the current state of file A to given filename |
| 309 | func (dv *DiffEditor) saveFileA(fname core.Filename) { //types:add |
no test coverage detected