MCPcopy Create free account
hub / github.com/cogentcore/core / autoSave

Method autoSave

texteditor/buffer.go:576–589  ·  view source on GitHub ↗

autoSave does the autosave -- safe to call in a separate goroutine

()

Source from the content-addressed store, hash-verified

574
575// autoSave does the autosave -- safe to call in a separate goroutine
576func (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
592func (tb *Buffer) AutoSaveDelete() {

Callers 5

DeleteTextMethod · 0.95
deleteTextRectMethod · 0.95
insertTextMethod · 0.95
insertTextRectMethod · 0.95
ReplaceTextMethod · 0.95

Calls 3

AutoSaveFilenameMethod · 0.95
BytesMethod · 0.45
PrintfMethod · 0.45

Tested by

no test coverage detected