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

Method OpenFS

texteditor/buffer.go:343–351  ·  view source on GitHub ↗

OpenFS loads the given file in the given filesystem into the buffer.

(fsys fs.FS, filename string)

Source from the content-addressed store, hash-verified

341
342// OpenFS loads the given file in the given filesystem into the buffer.
343func (tb *Buffer) OpenFS(fsys fs.FS, filename string) error {
344 txt, err := fs.ReadFile(fsys, filename)
345 if err != nil {
346 return err
347 }
348 tb.SetFilename(filename)
349 tb.SetText(txt)
350 return nil
351}
352
353// openFile just loads the given file into the buffer, without doing
354// any markup or signaling. It is typically used in other functions or

Callers 1

TestEditorOpenFSFunction · 0.45

Calls 3

SetFilenameMethod · 0.95
SetTextMethod · 0.95
ReadFileMethod · 0.80

Tested by 1

TestEditorOpenFSFunction · 0.36