From 0ce4e75a38fbe5d4dc7688a4c65a56bf0a8d332d Mon Sep 17 00:00:00 2001 From: Opportunity Date: Thu, 16 Jan 2020 18:25:47 +0800 Subject: improve serialize --- xmake/core/base/serialize.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- cgit v1.3.1