Browse Source

Ignore files beginning with dots and directories

Skip files beginning with . and directories (whilst we are at it). The
reason to skip files beginning with dots is that they are never valid
zone files (illegal zone name) and emacs creates temporary files beginning
with '.#' whilst editing exising zonefiles.

Signed-off-by: Alex Bligh <[email protected]>
Alex Bligh 10 years ago
parent
commit
455564dd68
1 changed files with 3 additions and 1 deletions
  1. 3 1
      zones.go

+ 3 - 1
zones.go

@@ -57,7 +57,9 @@ func zonesReadDir(dirName string, zones Zones) error {
 
 	for _, file := range dir {
 		fileName := file.Name()
-		if !strings.HasSuffix(strings.ToLower(fileName), ".json") {
+		if !strings.HasSuffix(strings.ToLower(fileName), ".json") ||
+			strings.HasPrefix(path.Base(fileName), ".") ||
+			file.IsDir() {
 			continue
 		}