OpenFS loads the given file in the given filesystem into the buffer.
(fsys fs.FS, filename string)
| 341 | |
| 342 | // OpenFS loads the given file in the given filesystem into the buffer. |
| 343 | func (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 |