NewDefaultFS returns a new defaultFS instance which allows `fs.FS.Open` to have absolute paths as input if it matches then given dir as prefix.
(dir string)
| 871 | // NewDefaultFS returns a new defaultFS instance which allows `fs.FS.Open` to have absolute paths as input if it matches |
| 872 | // then given dir as prefix. |
| 873 | func NewDefaultFS(dir string) fs.FS { |
| 874 | return &defaultFS{ |
| 875 | prefix: dir, |
| 876 | fs: os.DirFS(dir), |
| 877 | } |
| 878 | } |
| 879 | |
| 880 | func (fs defaultFS) Open(name string) (fs.File, error) { |
| 881 | // fs.FS.Open() already assumes that file names are relative to FS root path and considers name with prefix `/` as invalid |
no outgoing calls
searching dependent graphs…