浏览代码

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 年之前
父节点
当前提交
455564dd68
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      zones.go

+ 3 - 1
zones.go

@@ -57,7 +57,9 @@ func zonesReadDir(dirName string, zones Zones) error {
 
 
 	for _, file := range dir {
 	for _, file := range dir {
 		fileName := file.Name()
 		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
 			continue
 		}
 		}