LingxinMeng 10 months ago
parent
commit
34dbf37ea1
1 changed files with 6 additions and 2 deletions
  1. 6 2
      common/util/u_io.go

+ 6 - 2
common/util/u_io.go

@@ -11,8 +11,12 @@ import (
 )
 
 func CheckSoFilesInDirectory(dirPath string) (bool, []string) {
-	var hasSoFile bool
-	var soFilePaths []string
+	hasSoFile := false
+	soFilePaths := make([]string, 0)
+	if _, err := os.Stat(dirPath); os.IsNotExist(err) {
+		fmt.Println("Directory does not exist:", dirPath)
+		return false, soFilePaths
+	}
 
 	err := filepath.Walk(dirPath, func(path string, info fs.FileInfo, err error) error {
 		if err != nil {