summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
-rw-r--r--xmake/core/sandbox/modules/os.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 87886f0b6..e17cf9ac2 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -27,6 +27,7 @@ local io = require("base/io")
local os = require("base/os")
local utils = require("base/utils")
local option = require("base/option")
+local semver = require("base/semver")
local sandbox = require("sandbox/sandbox")
local vformat = require("sandbox/modules/vformat")
@@ -434,6 +435,24 @@ function sandbox_os.readlink(symlink)
return result
end
+-- get xmake version
+function sandbox_os.xmakever()
+
+ -- get it from cache first
+ if sandbox_os._XMAKEVER ~= nil then
+ return sandbox_os._XMAKEVER
+ end
+
+ -- get xmakever
+ local xmakever = semver.new(xmake._VERSION_SHORT)
+
+ -- save to cache
+ os._XMAKEVER = xmakever or false
+
+ -- done
+ return xmakever
+end
+
-- return module
return sandbox_os