aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <0xdec05eba@gmail.com>2018-09-24 15:50:33 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-09-24 15:50:34 +0200
commitf414fe587cef52cb8ff2b73a320ee0ce481170b6 (patch)
tree3cc7477e00a049998aab4eb98998b441564a9db4 /src
parent0ebcfc62e435d352b4a2035ac1791b867228194d (diff)
Escape special characters ninja way
Diffstat (limited to 'src')
-rw-r--r--src/Ninja.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Ninja.cpp b/src/Ninja.cpp
index 778e701..70b0b57 100644
--- a/src/Ninja.cpp
+++ b/src/Ninja.cpp
@@ -78,12 +78,18 @@ namespace ninja
result.reserve(str.size());
for(char c : str)
{
- if(c == '"')
- result += "\\\"";
+ if(c == '\n')
+ result += "$\n";
+ else if(c == '$')
+ result += "$$";
+ else if(c == ' ')
+ result += "$ ";
+ else if(c == ':')
+ result += "$:";
else
result += c;
}
- return '"' + result + '"';
+ return result;
}
static std::string combine_escape(const std::vector<std::string> &strs)