modweb/module/list.go
2020-10-25 01:26:01 +02:00

24 lines
370 B
Go

package module
import (
"io/ioutil"
"path"
"strings"
)
func List(modulesPath string) ([]string, error) {
files, err := ioutil.ReadDir(modulesPath)
if err != nil {
return nil, err
}
var res []string
for _, file := range files {
if strings.HasSuffix(file.Name(), ".so") {
res = append(res, path.Join(modulesPath, file.Name()))
}
}
return res, nil
}