diff --git a/gyp_chromium b/gyp_chromium index d05204b77..8713b4340 100755 --- a/gyp_chromium +++ b/gyp_chromium @@ -77,8 +77,9 @@ def FormatKeyForGN(key): def EscapeStringForGN(s): """Converts a string to a GN string literal.""" - # Escape $ characters which have special meaning to GN. - return '"' + s.replace('$', '\\$').replace('"', '\\"') + '"' + for old, new in [('\\', '\\\\'), ('$', '\\$'), ('"', '\\"')]: + s = s.replace(old, new) + return '"' + s + '"' def ProcessGypDefinesItems(items):