diff options
Diffstat (limited to 'xmake/core/cache/localcache.lua')
| -rw-r--r-- | xmake/core/cache/localcache.lua | 5 |
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) |
