25 lines
383 B
Go
25 lines
383 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"path/filepath"
|
||
|
)
|
||
|
|
||
|
func fnNoExt(fileName string) string {
|
||
|
return fileName[:len(fileName)-len(filepath.Ext(fileName))]
|
||
|
}
|
||
|
|
||
|
func GetAmbiance() ([]string, error) {
|
||
|
files, err := os.ReadDir("./ambiance")
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
var out []string
|
||
|
for _, file := range files {
|
||
|
out = append(out, fnNoExt(file.Name()))
|
||
|
}
|
||
|
|
||
|
return out, nil
|
||
|
}
|