autoSave does the autosave -- safe to call in a separate goroutine
()
| 574 | |
| 575 | // autoSave does the autosave -- safe to call in a separate goroutine |
| 576 | func (tb *Buffer) autoSave() error { |
| 577 | if tb.autoSaving { |
| 578 | return nil |
| 579 | } |
| 580 | tb.autoSaving = true |
| 581 | asfn := tb.AutoSaveFilename() |
| 582 | b := tb.Bytes() |
| 583 | err := os.WriteFile(asfn, b, 0644) |
| 584 | if err != nil { |
| 585 | log.Printf("core.Buf: Could not AutoSave file: %v, error: %v\n", asfn, err) |
| 586 | } |
| 587 | tb.autoSaving = false |
| 588 | return err |
| 589 | } |
| 590 | |
| 591 | // AutoSaveDelete deletes any existing autosave file |
| 592 | func (tb *Buffer) AutoSaveDelete() { |
no test coverage detected