Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6428)

Unified Diff: build/gyp_chromium

Issue 144573004: gn/gyp: Escape \ in addition to $ and " in strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: foo Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/gyp_chromium
diff --git a/build/gyp_chromium b/build/gyp_chromium
index d05204b77f2b769af4a1436a45870dcb6fbb5ba9..8713b43400a098c3d90fe3dad72fc75883ce5076 100755
--- a/build/gyp_chromium
+++ b/build/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):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698