func loadIgnoreFile(dir string) CfIgnore { file, err := os.Open(filepath.Join(dir, ".cfignore")) if err == nil { return NewCfIgnore(fileutils.ReadFile(file)) } else { return NewCfIgnore("") } }
func readCfIgnore(dir string) (exclusions Globs) { cfIgnore, err := os.Open(filepath.Join(dir, ".cfignore")) if err != nil { return } ignores := strings.Split(fileutils.ReadFile(cfIgnore), "\n") ignores = append(DefaultIgnoreFiles, ignores...) for _, pattern := range ignores { pattern = strings.TrimSpace(pattern) if pattern == "" { continue } pattern = path.Clean(pattern) patternExclusions := exclusionsForPattern(pattern) exclusions = append(exclusions, patternExclusions...) } return }