MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / GetSoundFiles

Function GetSoundFiles

internal/audio/audio.go:72–94  ·  view source on GitHub ↗

GetSoundFiles returns a sorted list of all sound filenames found recursively under PublicHtml/static/audio/sound/. Files whose names begin with "_" are skipped.

()

Source from the content-addressed store, hash-verified

70// GetSoundFiles returns a sorted list of all sound filenames found recursively
71// under PublicHtml/static/audio/sound/. Files whose names begin with "_" are skipped.
72func GetSoundFiles() []string {
73 publicHtml := configs.GetFilePathsConfig().PublicHtml.String()
74 root := filepath.Join(publicHtml, "static", "audio", "sound")
75
76 var files []string
77 _ = filepath.WalkDir(root, func(path string, d os.DirEntry, err error) error {
78 if err != nil || d.IsDir() {
79 return nil
80 }
81 name := d.Name()
82 if strings.HasPrefix(name, "_") {
83 return nil
84 }
85 rel, relErr := filepath.Rel(publicHtml, path)
86 if relErr != nil {
87 return nil
88 }
89 files = append(files, filepath.ToSlash(rel))
90 return nil
91 })
92 sort.Strings(files)
93 return files
94}
95
96func SaveAudio(entries map[string]AudioConfig) error {
97 if entries == nil {

Callers 3

apiV1GetAudioFunction · 0.92
apiV1CreateAudioFunction · 0.92
apiV1PatchAudioFunction · 0.92

Calls 3

GetFilePathsConfigFunction · 0.92
StringMethod · 0.65
NameMethod · 0.45

Tested by

no test coverage detected