Browse Source

GetAllFilePath增加error处理

ila 4 years ago
parent
commit
a2779eba96
1 changed files with 8 additions and 2 deletions
  1. 8 2
      core/file.go

+ 8 - 2
core/file.go

@@ -19,8 +19,14 @@ func GetAllFilePath(filePaths []string, currentPath string) ([]string, error) {
 	}
 	for _, f := range files {
 		if f.IsDir() {
-			ret, _ := GetAllFilePath(filePaths, filepath.Join(currentPath, f.Name()))
-			filePaths = append(filePaths, ret...)
+			ret, err := GetAllFilePath(filePaths, filepath.Join(currentPath, f.Name()))
+			if err != nil {
+				log.Printf("GetAllFilePath eror: %v\n", err)
+				return filePaths, err
+			} else {
+				filePaths = append(filePaths, ret...)
+			}
+
 		} else {
 			filePaths = append(filePaths, filepath.Join(currentPath, f.Name()))
 		}