summaryrefslogtreecommitdiff
path: root/xmake/core/cache/localcache.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-13 19:54:14 +0800
committerruki <[email protected]>2021-03-13 19:54:14 +0800
commit9ffff00c4d85642dd6ced7c341b9e735fcdcb8e3 (patch)
tree14e3cd268b3de4d3bac3c72d4123e7df4c80f1b3 /xmake/core/cache/localcache.lua
parent1d95a70ff5c3df8fe56120bed92a2de1dbfdf62d (diff)
fix localcache
Diffstat (limited to 'xmake/core/cache/localcache.lua')
-rw-r--r--xmake/core/cache/localcache.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmake/core/cache/localcache.lua b/xmake/core/cache/localcache.lua
index d5cc3d03a..8f99a16d7 100644
--- a/xmake/core/cache/localcache.lua
+++ b/xmake/core/cache/localcache.lua
@@ -50,7 +50,7 @@ end
-- load cache
function _instance:load()
- if os.isdir(config.directory()) then
+ if os.isfile(os.projectfile()) or os.isdir(config.directory()) then
local result = io.load(path.join(config.cachedir(), self:name()))
if result ~= nil then
self._DATA = result
@@ -60,7 +60,8 @@ end
-- save cache
function _instance:save()
- if os.isdir(config.directory()) then
+ -- for xmake project or trybuild mode
+ if os.isfile(os.projectfile()) or os.isdir(config.directory()) then
local ok, errors = io.save(path.join(config.cachedir(), self:name()), self._DATA)
if not ok then
os.raise(errors)