summaryrefslogtreecommitdiff
path: root/xmake/core/base/serialize.lua
diff options
context:
space:
mode:
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)