diff options
| author | ruki <[email protected]> | 2019-01-02 22:37:00 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-01-02 09:42:04 +0800 |
| commit | cc976c3fc70c83373e2984ee26ccbff4df5efa85 (patch) | |
| tree | 4bfe845d1040fc15a798bffbb8aebbd241f8550d /xmake/core/theme/theme.lua | |
| parent | 59c8c59a2983c329118f7839b9949635a85183f5 (diff) | |
add plain theme
Diffstat (limited to 'xmake/core/theme/theme.lua')
| -rw-r--r-- | xmake/core/theme/theme.lua | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/xmake/core/theme/theme.lua b/xmake/core/theme/theme.lua index 7d45bf274..5256de788 100644 --- a/xmake/core/theme/theme.lua +++ b/xmake/core/theme/theme.lua @@ -29,10 +29,8 @@ local _instance = _instance or {} -- load modules local os = require("base/os") local path = require("base/path") -local utils = require("base/utils") local table = require("base/table") local interpreter = require("base/interpreter") -local sandbox = require("sandbox/sandbox") local global = require("base/global") -- new an instance @@ -110,12 +108,6 @@ end -- load the given theme function theme.load(name) - -- get it directly from cache dirst - theme._THEMES = theme._THEMES or {} - if theme._THEMES[name] then - return theme._THEMES[name] - end - -- find the theme script path local scriptpath = nil for _, dir in ipairs(theme.directories()) do @@ -157,18 +149,16 @@ function theme.load(name) return nil, errors end - -- save instance to the cache - theme._THEMES[name] = instance + -- save the current theme instance + theme._THEME = instance return instance end -- get the given theme configuration function theme.get(name) - local instance, errors = theme.load(global.get("theme") or "default") + local instance = theme._THEME if instance then return instance:get(name) - else - os.raise(errors) end end |
