| 87 | } |
| 88 | |
| 89 | func (s *SnapshotFS) GetFileByPath(fileName string, path tspath.Path) FileHandle { |
| 90 | if file, ok := s.overlays[path]; ok { |
| 91 | return file |
| 92 | } |
| 93 | if file, ok := s.diskFiles[path]; ok { |
| 94 | return file |
| 95 | } |
| 96 | newEntry := memoizedDiskFile(sync.OnceValue(func() FileHandle { |
| 97 | if contents, ok := s.fs.ReadFile(fileName); ok { |
| 98 | return newDiskFile(fileName, contents) |
| 99 | } |
| 100 | return nil |
| 101 | })) |
| 102 | entry, _ := s.readFiles.LoadOrStore(path, newEntry) |
| 103 | return entry() |
| 104 | } |
| 105 | |
| 106 | func (s *SnapshotFS) GetAccessibleEntries(directoryName string) vfs.Entries { |
| 107 | var entries vfs.Entries |