From 5666d5b1b0c26f28c90ce92800b46200e76c6967 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 11 Mar 2019 12:38:21 +0000 Subject: [PATCH] Projucer: Escape single quote marks in the function generated by the --obfuscated-string-code command-line tool --- .../Projucer/Source/Application/jucer_CommandLine.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extras/Projucer/Source/Application/jucer_CommandLine.cpp b/extras/Projucer/Source/Application/jucer_CommandLine.cpp index 13c9ff0c86..8b480db961 100644 --- a/extras/Projucer/Source/Application/jucer_CommandLine.cpp +++ b/extras/Projucer/Source/Application/jucer_CommandLine.cpp @@ -541,8 +541,16 @@ namespace out << " String " << name << "; " << name; + auto escapeIfSingleQuote = [] (const String& s) -> String + { + if (s == "\'") + return "\\'"; + + return s; + }; + for (int i = 0; i < text.length(); ++i) - out << " << '" << String::charToString (text[i]) << "'"; + out << " << '" << escapeIfSingleQuote (String::charToString (text[i])) << "'"; out << ";" << preferredLineFeed; }