From 9ffff00c4d85642dd6ced7c341b9e735fcdcb8e3 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 13 Mar 2021 19:54:14 +0800 Subject: fix localcache --- xmake/core/cache/localcache.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xmake/core/cache/localcache.lua') 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) -- cgit v1.3.1