diff options
| author | ruki <[email protected]> | 2018-10-07 00:05:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-10-07 00:05:45 +0800 |
| commit | fbc34dadcfdff7f06a1927fbb593503c5149995b (patch) | |
| tree | c9008e3c62e5f22e5a9e0a261b20d9c6d1b4ce21 /xmake/core/base/winos.lua | |
| parent | 4307ac5dabce5177d1517b0e043a35b5a7c58512 (diff) | |
add macos and winos version
Diffstat (limited to 'xmake/core/base/winos.lua')
| -rw-r--r-- | xmake/core/base/winos.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/xmake/core/base/winos.lua b/xmake/core/base/winos.lua index c9ab70be3..c78637b17 100644 --- a/xmake/core/base/winos.lua +++ b/xmake/core/base/winos.lua @@ -25,5 +25,33 @@ -- define module: winos local winos = winos or {} +-- load modules +local os = require("base/os") + +-- get system version +function winos.version() + + -- get it from cache first + if winos._VERSION ~= nil then + return winos._VERSION + end + + -- get winver + local winver = nil + local ok, verstr = os.iorun("cmd /c ver") + if ok and verstr then + winver = verstr:match("%[.-(%d+%.%d+%.%d+)]") + if winver then + winver = winver:trim() + end + end + + -- save to cache + winos._VERSION = winver or false + + -- done + return winver +end + -- return module: winos return winos |
