summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-07-23 19:52:55 +0800
committerOpportunityLiu <[email protected]>2019-07-23 19:52:55 +0800
commitd46f79c50f0e8c71fba605d8f3be3358c8569d62 (patch)
treec1c9265cbf0bd55cf465c72c3b8049140f2a86f6
parenteb7702f18022119677bff1d2c383ff82298141f1 (diff)
fix xmakever cache
-rw-r--r--xmake/core/sandbox/modules/os.lua18
1 files changed, 8 insertions, 10 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 2fc508fff..d8ec0abe4 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -22,6 +22,7 @@
local io = require("base/io")
local os = require("base/os")
local utils = require("base/utils")
+local xmake = require("base/xmake")
local option = require("base/option")
local semver = require("base/semver")
local sandbox = require("sandbox/sandbox")
@@ -480,19 +481,16 @@ end
-- get xmake version
function sandbox_os.xmakever()
- -- get it from cache first
- if sandbox_os._XMAKEVER ~= nil then
- return sandbox_os._XMAKEVER
+ -- fill cache
+ if sandbox_os._XMAKEVER == nil then
+ -- get xmakever
+ local xmakever = semver.new(xmake._VERSION_SHORT)
+ -- save to cache
+ sandbox_os._XMAKEVER = xmakever or false
end
- -- get xmakever
- local xmakever = semver.new(xmake._VERSION_SHORT)
-
- -- save to cache
- os._XMAKEVER = xmakever or false
-
-- done
- return xmakever
+ return sandbox_os._XMAKEVER or nil
end
-- return module