ソースを参照

更新GetAllFilePath

ila 4 年 前
コミット
530dcb2011
1 ファイル変更3 行追加2 行削除
  1. 3 2
      core/file.go

+ 3 - 2
core/file.go

@@ -9,7 +9,7 @@ import (
 )
 
 // GetAllFilePath 获取指定目录内的文件和子目录的文件,递归获取
-func GetAllFilePath(filePaths []string, currentPath string) (excelPaths []string, err error) {
+func GetAllFilePath(filePaths []string, currentPath string) ([]string, error) {
 	//2021-12-23
 	files, err := ioutil.ReadDir(currentPath)
 
@@ -19,7 +19,8 @@ func GetAllFilePath(filePaths []string, currentPath string) (excelPaths []string
 	}
 	for _, f := range files {
 		if f.IsDir() {
-			return GetAllFilePath(filePaths, filepath.Join(currentPath, f.Name()))
+			ret, _ := GetAllFilePath(filePaths, filepath.Join(currentPath, f.Name()))
+			filePaths = append(filePaths, ret...)
 		} else {
 			filePaths = append(filePaths, filepath.Join(currentPath, f.Name()))
 		}