diff options
| author | ruki <[email protected]> | 2020-03-26 00:07:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-03-25 18:43:45 +0800 |
| commit | 493fffe734e944e153c04bbe46e77c2069581f47 (patch) | |
| tree | 456f14038827fad4f33f1cc64a7c8d9d01e9ca79 /xmake/plugins | |
| parent | c570330bbc7fd11410985a46486e7c5edc66d9bf (diff) | |
improve os.args
Diffstat (limited to 'xmake/plugins')
| -rw-r--r-- | xmake/plugins/project/clang/compile_commands.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xmake/plugins/project/clang/compile_commands.lua b/xmake/plugins/project/clang/compile_commands.lua index 894740411..4ded1e11a 100644 --- a/xmake/plugins/project/clang/compile_commands.lua +++ b/xmake/plugins/project/clang/compile_commands.lua @@ -40,7 +40,7 @@ function _make_object(jsonfile, target, sourcefile, objectfile) -- escape '"', '\' local arguments_escape = {} for _, arg in ipairs(arguments) do - table.insert(arguments_escape, (arg:gsub("[\"\\]", "\\%1"))) + table.insert(arguments_escape, os.args(arg, {escape = true})) end -- make body @@ -49,7 +49,7 @@ function _make_object(jsonfile, target, sourcefile, objectfile) "directory": "%s", "arguments": ["%s"], "file": "%s" -}]], ifelse(_g.firstline, "", ",\n"), os.args(os.projectdir()), table.concat(arguments_escape, "\", \""), os.args(sourcefile)) +}]], (_g.firstline and "" or ",\n"), os.args(os.projectdir(), {escape = true}), table.concat(arguments_escape, "\", \""), os.args(sourcefile, {escape = true})) -- clear first line marks _g.firstline = false |
