github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/abis/walk_folders.go (about)

     1  package abisPkg
     2  
     3  import (
     4  	"path/filepath"
     5  
     6  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config"
     7  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk"
     8  )
     9  
    10  func (opts *AbisOptions) ForEveryAbi(known bool, vFunc walk.ForEveryFunc, errorChan chan error) {
    11  	chain := opts.Globals.Chain
    12  	testMode := opts.Globals.TestMode
    13  
    14  	paths := make([]string, 0, 2)
    15  	if known {
    16  		paths = append(paths, filepath.Join(config.PathToRootConfig(), "abis"))
    17  	}
    18  
    19  	if !testMode {
    20  		paths = append(paths, filepath.Join(config.PathToCache(chain), "abis"))
    21  	}
    22  
    23  	for _, path := range paths {
    24  		_ = walk.ForEveryFileInFolder(path, vFunc, errorChan)
    25  	}
    26  }