summaryrefslogtreecommitdiff
path: root/xmake/core/base/serialize.lua
diff options
context:
space:
mode:
authorOpportunity <[email protected]>2020-01-16 18:25:47 +0800
committerOpportunity <[email protected]>2020-01-16 18:25:47 +0800
commit0ce4e75a38fbe5d4dc7688a4c65a56bf0a8d332d (patch)
treed32caaae7561be4036bb512806eb60545849470e /xmake/core/base/serialize.lua
parent6b150874b14eded0f8754286ce2c579e418c9e94 (diff)
improve serialize
Diffstat (limited to 'xmake/core/base/serialize.lua')
-rw-r--r--xmake/core/base/serialize.lua6
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)