forked from mirror/viper
test: fix finder tests on windows
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
78228f56c5
commit
237f373936
8
fs.go
8
fs.go
|
@ -6,7 +6,7 @@ package viper
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"path/filepath"
|
"path"
|
||||||
)
|
)
|
||||||
|
|
||||||
type finder struct {
|
type finder struct {
|
||||||
|
@ -18,10 +18,10 @@ type finder struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f finder) Find(fsys fs.FS) (string, error) {
|
func (f finder) Find(fsys fs.FS) (string, error) {
|
||||||
for _, path := range f.paths {
|
for _, searchPath := range f.paths {
|
||||||
for _, fileName := range f.fileNames {
|
for _, fileName := range f.fileNames {
|
||||||
for _, extension := range f.extensions {
|
for _, extension := range f.extensions {
|
||||||
filePath := filepath.Join(path, fileName+"."+extension)
|
filePath := path.Join(searchPath, fileName+"."+extension)
|
||||||
|
|
||||||
ok, err := fileExists(fsys, filePath)
|
ok, err := fileExists(fsys, filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -34,7 +34,7 @@ func (f finder) Find(fsys fs.FS) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.withoutExtension {
|
if f.withoutExtension {
|
||||||
filePath := filepath.Join(path, fileName)
|
filePath := path.Join(searchPath, fileName)
|
||||||
|
|
||||||
ok, err := fileExists(fsys, filePath)
|
ok, err := fileExists(fsys, filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -13,8 +13,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFinder(t *testing.T) {
|
func TestFinder(t *testing.T) {
|
||||||
skipWindows(t)
|
|
||||||
|
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
fsys := fstest.MapFS{
|
fsys := fstest.MapFS{
|
||||||
|
|
Loading…
Reference in New Issue