diff options
| author | Opportunity <[email protected]> | 2020-01-16 18:25:47 +0800 |
|---|---|---|
| committer | Opportunity <[email protected]> | 2020-01-16 18:25:47 +0800 |
| commit | 0ce4e75a38fbe5d4dc7688a4c65a56bf0a8d332d (patch) | |
| tree | d32caaae7561be4036bb512806eb60545849470e /xmake/core/base/serialize.lua | |
| parent | 6b150874b14eded0f8754286ce2c579e418c9e94 (diff) | |
improve serialize
Diffstat (limited to 'xmake/core/base/serialize.lua')
| -rw-r--r-- | xmake/core/base/serialize.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/core/base/serialize.lua b/xmake/core/base/serialize.lua index 6095fea9a..331e124a0 100644 --- a/xmake/core/base/serialize.lua +++ b/xmake/core/base/serialize.lua @@ -41,7 +41,11 @@ function serialize._keywords() end function serialize._makestring(str, opt) - return string.format("%q", str) + if string.find(str, "\\", 1, true) and not string.find(str, "[%c%]%\n]") then + return string.format("[[%s]]", str) + else + return string.format("%q", str) + end end function serialize._makedefault(val, opt) |
