]> 127.0.0.1 Git - part/.git/commitdiff
32
authorqydysky <qydysky@foxmail.com>
Mon, 3 Aug 2020 09:48:51 +0000 (17:48 +0800)
committerqydysky <qydysky@foxmail.com>
Mon, 3 Aug 2020 09:48:51 +0000 (17:48 +0800)
CheckFile.go

index d8b27ed908f42c04b145cc544dd2eaa2fe17b38a..f66ea4ee95bb9cc64c4b7681167b2a1443a71af0 100644 (file)
@@ -48,12 +48,16 @@ func (this *checkfile) Build(checkFile,root,checkDir,SplitString string,usemd5 b
 }
 
 func (this *checkfile) IsExist(f string) bool {
-       var returnVal chan bool = make(chan bool)
-       go func(){
-               _, err := os.Stat(f)
-               returnVal <- (err == nil || os.IsExist(err))
-       }()
-       return <- returnVal
+       _, err := os.Stat(f)
+       if err != nil {
+               if os.IsNotExist(err) {
+                       return false
+               }else{
+                       Logf().E(err)
+                       return false
+               }
+       }
+       return true
 }
 
 func (this *checkfile) IsOpen(f string) bool {