diff options
| author | ruki <[email protected]> | 2020-12-26 10:25:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-12-26 10:25:26 +0800 |
| commit | 0ffe195f2b6caaee85c3ca3ac7fc5444fdafbbbc (patch) | |
| tree | 81944686b8bebb528ac6bfea4aa0baa49d96665b /xmake | |
| parent | ffa5076427512f9b475f6a808831160c29d87268 (diff) | |
impl winos.registry_keys
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/core/base/winos.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/xmake/core/base/winos.lua b/xmake/core/base/winos.lua index 57f83bb5e..57aedeaf3 100644 --- a/xmake/core/base/winos.lua +++ b/xmake/core/base/winos.lua @@ -241,17 +241,29 @@ function winos.registry_keys(keypath) end -- get the root directory + local pattern local rootdir = keypath:sub(p + 1) p = rootdir:find("*", 1, true) if p then rootdir = path.directory(rootdir:sub(1, p - 1)) + pattern = path.pattern(keypath) end - -- get key pattern with a lua pattern - local pattern = path.pattern(keypath) + print(rootkey, rootdir, pattern) -- get keys - return winos._registry_keys(rootkey, rootdir, pattern) + local keys = {} + local count, errors = winos._registry_keys(rootkey, rootdir, function (key) + if not pattern or key:match("^" .. pattern .. "$") then + table.insert(keys, key) + end + return true + end) + if count ~= nil then + return keys + else + return nil, errors + end end -- get registry values from the given key path |
