mirror of
https://github.com/Baipyrus/ProxySwitcher.git
synced 2024-12-26 04:31:45 +00:00
ignore all non-JSON files within configs directory
This commit is contained in:
parent
4340ca271d
commit
7d6184cf4f
@ -14,7 +14,10 @@ func ReadConfigs(cfgPath string) ([]*Config, error) {
|
|||||||
var configs []*Config
|
var configs []*Config
|
||||||
|
|
||||||
err := filepath.Walk(cfgPath, func(path string, info fs.FileInfo, err error) error {
|
err := filepath.Walk(cfgPath, func(path string, info fs.FileInfo, err error) error {
|
||||||
if info.IsDir() || strings.HasSuffix(info.Name(), ".example.json") {
|
name := info.Name()
|
||||||
|
isExample := strings.HasSuffix(name, ".example.json")
|
||||||
|
notJson := !strings.HasSuffix(name, ".json")
|
||||||
|
if info.IsDir() || isExample || notJson {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user