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

Method saveFile

texteditor/buffer.go:445–456  ·  view source on GitHub ↗

saveFile writes current buffer to file, with no prompting, etc

(filename core.Filename)

Source from the content-addressed store, hash-verified

443
444// saveFile writes current buffer to file, with no prompting, etc
445func (tb *Buffer) saveFile(filename core.Filename) error {
446 err := os.WriteFile(string(filename), tb.Bytes(), 0644)
447 if err != nil {
448 core.ErrorSnackbar(tb.sceneFromEditor(), err)
449 slog.Error(err.Error())
450 } else {
451 tb.clearNotSaved()
452 tb.Filename = filename
453 tb.Stat()
454 }
455 return err
456}
457
458// Save saves the current text into the current filename associated with this buffer.
459func (tb *Buffer) Save() error { //types:add

Callers 2

SaveAsFuncMethod · 0.95
SaveMethod · 0.95

Calls 6

sceneFromEditorMethod · 0.95
clearNotSavedMethod · 0.95
StatMethod · 0.95
ErrorSnackbarFunction · 0.92
ErrorMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected