From 6ae2885a3be0362228c8f2207572901c0042d875 Mon Sep 17 00:00:00 2001 From: qydysky Date: Tue, 28 Jul 2020 07:32:21 +0800 Subject: [PATCH] 10 --- Lock.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lock.go b/Lock.go index c33dcef..9b28540 100644 --- 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 } -- 2.39.2