MCPcopy
hub / github.com/wavetermdev/waveterm / readConfigFilesForDir

Function readConfigFilesForDir

pkg/wconfig/settingsconfig.go:636–648  ·  view source on GitHub ↗

Read and merge all files in the specified directory matching the supplied suffix

(fsys fs.FS, logPrefix string, dirName string, fileName string, simpleMerge bool)

Source from the content-addressed store, hash-verified

634
635// Read and merge all files in the specified directory matching the supplied suffix
636func readConfigFilesForDir(fsys fs.FS, logPrefix string, dirName string, fileName string, simpleMerge bool) (waveobj.MetaMapType, []ConfigError) {
637 dirEnts, _ := fs.ReadDir(fsys, dirName)
638 suffixEnts := selectDirEntsBySuffix(dirEnts, fileName+".json")
639 SortFileNameDescend(suffixEnts)
640 var rtn waveobj.MetaMapType
641 var errs []ConfigError
642 for _, ent := range suffixEnts {
643 fileVal, cerrs := readConfigFileFS(fsys, logPrefix, filepath.Join(dirName, ent.Name()))
644 rtn = mergeMetaMap(rtn, fileVal, simpleMerge)
645 errs = append(errs, cerrs...)
646 }
647 return rtn, errs
648}
649
650// Read and merge all files in the specified config filesystem matching the patterns `<partName>.json` and `<partName>/*.json`
651func readConfigPartForFS(fsys fs.FS, logPrefix string, partName string, simpleMerge bool) (waveobj.MetaMapType, []ConfigError) {

Callers 1

readConfigPartForFSFunction · 0.85

Calls 5

selectDirEntsBySuffixFunction · 0.85
SortFileNameDescendFunction · 0.85
readConfigFileFSFunction · 0.85
mergeMetaMapFunction · 0.85
NameMethod · 0.45

Tested by

no test coverage detected