]> 127.0.0.1 Git - part/.git/commitdiff
1
authorqydysky <qydysky@foxmail.com>
Sat, 25 Jul 2020 22:43:33 +0000 (06:43 +0800)
committerqydysky <qydysky@foxmail.com>
Sat, 25 Jul 2020 23:30:08 +0000 (07:30 +0800)
CheckFile.go
linuxwin/linux.go
linuxwin/win.go

index 9a8842e3c783730d70daca21f0fe8e9ed9060904..ee88871262d7df7920642ab9bc5f8752b526e083 100644 (file)
@@ -1,7 +1,6 @@
 package part 
 
 import (
-    "sync"
     "fmt"
        "time"
        "runtime"
@@ -9,12 +8,10 @@ import (
        "syscall"
     "errors"
     "os"
-       "io/ioutil"     
-       
-    "github.com/qydysky/part/linuxwin"
+       "io/ioutil"
 )
 
-type checkfile struct {sync.Mutex}
+type checkfile struct {}
 
 func Checkfile() *checkfile{
     return &checkfile{}
@@ -102,10 +99,8 @@ func (this *checkfile) Check(checkFile,checkDir,SplitString string) bool {
 }
 
 func (this *checkfile) IsExist(f string) bool {
-    this.Lock()
-       defer this.Unlock()
-
-    return Ppart.PIsExist(f)
+       _, err := os.Stat(f)
+       return err == nil || os.IsExist(err)
 }
 
 func (this *checkfile) IsOpen(f string) bool {
@@ -116,8 +111,6 @@ func (this *checkfile) IsOpen(f string) bool {
 }
 
 func (this *checkfile) Checkfile(src string)(string,error){
-    this.Lock()
-       defer this.Unlock()
 
     str,err:=this.GetAllFile(src)
 
@@ -128,8 +121,6 @@ func (this *checkfile) Checkfile(src string)(string,error){
 }
 
 func (this *checkfile) GetAllFile(pathname string) (string,error) {
-       this.Lock()
-       defer this.Unlock()
 
     var returnVal string = ""
 
@@ -147,8 +138,6 @@ func (this *checkfile) GetAllFile(pathname string) (string,error) {
 }
 
 func (this *checkfile) GetFileSize(path string) int64 {
-    this.Lock()
-       defer this.Unlock()
 
     if !this.IsExist(path) {
         return 0
@@ -222,8 +211,6 @@ func (this *checkfile) CheckList(checkFile,checkDir,SplitString string)bool{
 }
 
 func (this *checkfile) GetFileModTime(path string) (error,int64) {
-    this.Lock()
-       defer this.Unlock()
 
        f, err := os.Open(path)
        if err != nil {
index 8aea6e717e81692acf37cdc246d59df7c4c4182c..c25f7ea12cc2b7fbb51c0f9280288eb4bff691e8 100755 (executable)
@@ -58,8 +58,3 @@ func PProxy(s, pacUrl string){
         PRun(true,"kwriteconfig5","--file","kioslaverc","--group","'Proxy Settings'","--key","Proxy Config Script","\""+pacUrl+"\"");
     }
 }
-
-func PIsExist(f string) bool{
-    _, err := os.Stat(f)
-    return err == nil || os.IsExist(err)
-}
\ No newline at end of file
index baaf17ab550c608ff2d6e9fa9206883fdbd89157..792f5e88d7bf01fd8e8ef4d16785206a2b708b16 100755 (executable)
@@ -93,8 +93,4 @@ func Cdir()string{
     dir, _ := os.Executable()
     exPath := filepath.Dir(dir)
     return exPath
-}
-func PIsExist(f string) bool{
-    _, err := os.Stat(f)
-    return err == nil || os.IsExist(err)
 }
\ No newline at end of file