summaryrefslogtreecommitdiff
path: root/xmake/core/project/option.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-04-01 13:59:49 +0800
committerruki <[email protected]>2017-04-01 13:59:49 +0800
commit16b5b77af09b348398fe46b2dcde0b5c0574abb5 (patch)
treeeec7205a3cc1261e0f4f45985802ba2ec8b46b77 /xmake/core/project/option.lua
parentcb5af728adf9d0d2f125c3054d1b6670d3debb9a (diff)
fix cache dir bug
Diffstat (limited to 'xmake/core/project/option.lua')
-rw-r--r--xmake/core/project/option.lua25
1 files changed, 20 insertions, 5 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index 5d0b6466d..23f0772ad 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -33,12 +33,27 @@ local table = require("base/table")
local utils = require("base/utils")
local option_ = require("base/option")
local config = require("project/config")
-local cache = require("project/cache")("local.option")
+local cache = require("project/cache")
local linker = require("tool/linker")
local compiler = require("tool/compiler")
local sandbox = require("sandbox/sandbox")
local language = require("language/language")
+-- get cache
+function option._cache()
+
+ -- get it from cache first if exists
+ if option._CACHE then
+ return option._CACHE
+ end
+
+ -- init cache
+ option._CACHE = cache("local.option")
+
+ -- ok
+ return option._CACHE
+end
+
-- check link
function option:_check_link(sourcefile, objectfile, targetfile)
@@ -512,15 +527,15 @@ end
function option:save()
-- save it
- cache:set(self:name(), self._INFO)
- cache:flush()
+ option._cache():set(self:name(), self._INFO)
+ option._cache():flush()
end
-- clear the option info for cache
function option:clear()
-- clear it
- cache:set(self:name(), nil)
+ option._cache():set(self:name(), nil)
end
-- get the option name
@@ -537,7 +552,7 @@ function option.load(name)
assert(name)
-- get info
- local info = cache:get(name)
+ local info = option._cache():get(name)
if info == nil then
return
end