From 6ef33a04fafe3a4b2ec757abcffb46ce5e7488ec Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 26 Jul 2019 22:19:02 +0800 Subject: lock the whole project for some actions --- xmake/core/sandbox/modules/import/core/project/project.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'xmake/core') diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua index a825f139a..cdd8562a3 100644 --- a/xmake/core/sandbox/modules/import/core/project/project.lua +++ b/xmake/core/sandbox/modules/import/core/project/project.lua @@ -148,6 +148,19 @@ function sandbox_core_project.directory() return project.directory() end +-- get the filelock of the whole project directory +function sandbox_core_project.filelock() + local filelock = sandbox_core_project._FILELOCK + if filelock == nil then + filelock = io.openlock(path.join(config.directory(), "project.lock")) + if not filelock then + raise("cannot create the project lock!") + end + sandbox_core_project._FILELOCK = filelock + end + return filelock +end + -- get the project mtimes function sandbox_core_project.mtimes() return project.mtimes() -- cgit v1.3.1