diff options
| author | ruki <[email protected]> | 2017-05-26 10:00:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-26 10:00:43 +0800 |
| commit | 7d0b8226faf9a4dfc67ded97c4d46e774c2d3ad2 (patch) | |
| tree | a8331eabf3db8fca5760c6bb5c67729a0fee92f8 /xmake/core/base/interpreter.lua | |
| parent | 27887740f2be1e2381511632a44b16f2dcddbc49 (diff) | |
improve match pattern for xxx_script
Diffstat (limited to 'xmake/core/base/interpreter.lua')
| -rw-r--r-- | xmake/core/base/interpreter.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua index 746347f32..a22c35ed6 100644 --- a/xmake/core/base/interpreter.lua +++ b/xmake/core/base/interpreter.lua @@ -280,6 +280,11 @@ function interpreter:_api_register_xxx_script(scope_kind, action, ...) os.raise("%s_%s(%s, %s): %s", action, name, tostring(arg1), tostring(arg2), errors) end + -- convert pattern to a lua pattern ('*' => '.*') + pattern = pattern:gsub("([%+%.%-%^%$%(%)%%])", "%%%1") + pattern = pattern:gsub("%*", "\001") + pattern = pattern:gsub("\001", ".*") + -- save script local scripts = scope[name] or {} if type(scripts) == "table" then |
