]> 127.0.0.1 Git - part/.git/commitdiff
10
authorqydysky <qydysky@foxmail.com>
Mon, 27 Jul 2020 23:32:21 +0000 (07:32 +0800)
committerqydysky <qydysky@foxmail.com>
Mon, 27 Jul 2020 23:32:21 +0000 (07:32 +0800)
Lock.go

diff --git a/Lock.go b/Lock.go
index c33dcefa5c9aec7e387b14c260a1d3ae0902790c..9b28540cb609ade4a10f5f26c8303decfd2c12c8 100644 (file)
--- a/Lock.go
+++ b/Lock.go
@@ -26,7 +26,10 @@ func (l *lock) Start(filePath string) int {
        if Checkfile().IsOpen(lock_md5Key) {return 2}
        if !Checkfile().IsExist(filePath) {return 3}
 
-       lock_md5Key = ".lock."+filePath
+       fi, err := os.Stat(filePath)
+       if err != nil {return 4}
+       
+       lock_md5Key = ".lock." + fi.Name()
        lock_file, _ = os.Create(lock_md5Key)
        return 0
 }