gn/gyp: Escape \ in addition to $ and " in strings.
BUG=340055 R=halyavin@google.com TBR=brettw@chromium.org Review URL: https://codereview.chromium.org/144573004 git-svn-id: http://src.chromium.org/svn/trunk/src/build@248410 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
cbd4e06bee
Коммит
123a18e910
|
@ -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):
|
||||
|
|
Загрузка…
Ссылка в новой задаче