use full file paths in file listing

This commit is contained in:
Alexander Weinhold 2016-11-19 01:08:56 +01:00
parent 64972dd953
commit 76ff27a9a6

View File

@ -2,6 +2,7 @@ package goutil
import ( import (
"io/ioutil" "io/ioutil"
"path"
"path/filepath" "path/filepath"
"strings" "strings"
) )
@ -28,7 +29,7 @@ func ListFilesExt(dir string, ext string) []string {
for _, file := range files { for _, file := range files {
if !file.IsDir() { if !file.IsDir() {
if strings.ToUpper(filepath.Ext(file.Name())) == ext { if strings.ToUpper(filepath.Ext(file.Name())) == ext {
list = append(list, file.Name()) list = append(list, path.Join(dir, file.Name()))
} }
} }
} }