MCPcopy Index your code
hub / github.com/jetify-com/devbox / FileContains

Function FileContains

internal/fileutil/fileutil.go:63–69  ·  view source on GitHub ↗

FileContains checks if a given file at 'path' contains the 'substring'

(path, substring string)

Source from the content-addressed store, hash-verified

61
62// FileContains checks if a given file at 'path' contains the 'substring'
63func FileContains(path, substring string) (bool, error) {
64 data, err := os.ReadFile(path)
65 if err != nil {
66 return false, err
67 }
68 return strings.Contains(string(data), substring), nil
69}
70
71func EnsureDirExists(path string, perm fs.FileMode, chmod bool) error {
72 if err := os.MkdirAll(path, perm); err != nil && !errors.Is(err, fs.ErrExist) {

Callers 1

checkOldEnvrcMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected