diff options
| -rw-r--r-- | CHANGELOG.md | 7 | ||||
| -rw-r--r-- | xmake/core/base/filter.lua | 26 |
2 files changed, 22 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c8a6203f7..6ba6e8423 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ ### Changes +* Improve builtin-variable format +* Support option for string type ### Bugs fixed @@ -149,6 +151,11 @@ * ����`getenv`�ӿڵ�`xmake.lua`��ȫ���������� * ��������vs200x���̲�� +### �Ľ� + +* ��ǿ�ڽ������Ĵ��� +* ֧���ַ������͵�ѡ��option���� + ### Bugs�� * ����linux�¼��ld������ʧ�ܣ����ûװg++�Ļ� diff --git a/xmake/core/base/filter.lua b/xmake/core/base/filter.lua index 5fc9cbed4..0af64bedb 100644 --- a/xmake/core/base/filter.lua +++ b/xmake/core/base/filter.lua @@ -98,24 +98,28 @@ function filter:handle(value) if variable:startswith("shell ") then return filter.shell(variable:sub(7, -1)) end - - -- is upper? - local isupper = false - local c = string.char(variable:byte()) - if c >= 'A' and c <= 'Z' then isupper = true end + -- parse variable:mode + local varmode = variable:split(':') + local mode = varmode[2] + variable = varmode[1] + -- handler it - local result = handler(variable:lower()) - - -- convert to upper? - if isupper and result and type(result) == "string" then - result = result:upper() - end + local result = handler(variable) -- invalid builtin variable? if result == nil then os.raise("invalid variable: $(%s)", variable) end + + -- handle mode + if mode then + if mode == "upper" then + result = result:upper() + elseif mode == "lower" then + result = result:lower() + end + end -- ok? return result |
