config: isTemporaryFile -> isIgnoredFile

This commit is contained in:
Mitchell Hashimoto 2015-03-19 09:51:14 +01:00
parent 49f850f13b
commit f84ae29cf8
1 changed files with 4 additions and 5 deletions

View File

@ -162,7 +162,7 @@ func dirFiles(dir string) ([]string, []string, error) {
// Only care about files that are valid to load // Only care about files that are valid to load
name := fi.Name() name := fi.Name()
extValue := ext(name) extValue := ext(name)
if extValue == "" || isTemporaryFile(name) { if extValue == "" || isIgnoredFile(name) {
continue continue
} }
@ -183,10 +183,9 @@ func dirFiles(dir string) ([]string, []string, error) {
return files, overrides, nil return files, overrides, nil
} }
// isTemporaryFile returns true or false depending on whether the // isIgnoredFile returns true or false depending on whether the
// provided file name is a temporary file for the following editors: // provided file name is a file that should be ignored.
// emacs or vim. func isIgnoredFile(name string) bool {
func isTemporaryFile(name string) bool {
return strings.HasPrefix(name, ".") || // Unix-like hidden files return strings.HasPrefix(name, ".") || // Unix-like hidden files
strings.HasSuffix(name, "~") || // vim strings.HasSuffix(name, "~") || // vim
(strings.HasPrefix(name, "#") && strings.HasSuffix(name, "#")) // emacs (strings.HasPrefix(name, "#") && strings.HasSuffix(name, "#")) // emacs