diff options
| author | ruki <[email protected]> | 2016-12-19 22:41:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-01-06 17:20:08 +0800 |
| commit | 42ff9b62aa8ef799d8a9cfc064a40311671bee54 (patch) | |
| tree | 6c7c91fccf1f4e0fbbe7419538ee0f7f526e60cf /xmake/core/platform/platform.lua | |
| parent | 32991ba6fad3bbc6c2069d9840a17347e60182e6 (diff) | |
impl language core
Diffstat (limited to 'xmake/core/platform/platform.lua')
| -rw-r--r-- | xmake/core/platform/platform.lua | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 88074a605..263f2e6e0 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -103,6 +103,31 @@ function _instance.new(name, info, rootdir) return instance end +-- get the platform configure +function _instance:get(name) + + -- the info + local info = self._INFO + + -- load it first + if self._g == nil and info.load ~= nil then + + -- load it + local ok, errors = sandbox.load(info.load) + if not ok then + os.raise(errors) + end + + -- save _g + self._g = getfenv(info.load)._g + end + + -- get it + if self._g ~= nil then + return self._g[name] + end +end + -- get the platform os function _instance:os() @@ -159,31 +184,6 @@ function _instance:environment() return self:_load("environment") end --- get the platform configure -function _instance:get(name) - - -- the info - local info = self._INFO - - -- load it first - if self._g == nil and info.load ~= nil then - - -- load it - local ok, errors = sandbox.load(info.load) - if not ok then - os.raise(errors) - end - - -- save _g - self._g = getfenv(info.load)._g - end - - -- get it - if self._g ~= nil then - return self._g[name] - end -end - -- the directories of platform function platform._directories() |
