diff options
Diffstat (limited to 'xmake/core/cache/localcache.lua')
| -rw-r--r-- | xmake/core/cache/localcache.lua | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/xmake/core/cache/localcache.lua b/xmake/core/cache/localcache.lua index 3fd5d040f..c40fe9ba9 100644 --- a/xmake/core/cache/localcache.lua +++ b/xmake/core/cache/localcache.lua @@ -50,17 +50,21 @@ end -- load cache function _instance:load() - local result = io.load(path.join(config.cachedir(), self:name())) - if result ~= nil then - self._DATA = result + if os.isfile(os.projectfile()) then + local result = io.load(path.join(config.cachedir(), self:name())) + if result ~= nil then + self._DATA = result + end end end -- save cache function _instance:save() - local ok, errors = io.save(path.join(config.cachedir(), self:name()), self._DATA) - if not ok then - os.raise(errors) + if os.isfile(os.projectfile()) then + local ok, errors = io.save(path.join(config.cachedir(), self:name()), self._DATA) + if not ok then + os.raise(errors) + end end end |
