| 1 |
//go:build windows |
| 2 |
|
| 3 |
package locafero |
| 4 |
|
| 5 |
import ( |
| 6 |
"fmt" |
| 7 |
|
| 8 |
"github.com/spf13/afero" |
| 9 |
) |
| 10 |
|
| 11 |
func ExampleFinder_Find() { |
| 12 |
// Use relative paths for Windows, because we do not know the absolute path. |
| 13 |
// fsys := afero.NewBasePathFs(afero.NewOsFs(), "testdata") |
| 14 |
fsys := afero.NewOsFs() |
| 15 |
|
| 16 |
finder := Finder{ |
| 17 |
Paths: []string{ |
| 18 |
"testdata\\home\\user", |
| 19 |
"testdata\\etc", |
| 20 |
}, |
| 21 |
Names: []string{"config.*"}, |
| 22 |
Type: FileTypeFile, |
| 23 |
} |
| 24 |
|
| 25 |
results, err := finder.Find(fsys) |
| 26 |
if err != nil { |
| 27 |
panic(err) |
| 28 |
} |
| 29 |
|
| 30 |
fmt.Println("On Windows:", results) |
| 31 |
|
| 32 |
// Output: |
| 33 |
// On Windows: [testdata\home\user\config.yaml testdata\etc\config.yaml] |
| 34 |
} |