summaryrefslogtreecommitdiff
path: root/editor/SCsub
diff options
context:
space:
mode:
Diffstat (limited to 'editor/SCsub')
-rw-r--r--editor/SCsub22
1 files changed, 6 insertions, 16 deletions
diff --git a/editor/SCsub b/editor/SCsub
index 11cdb471a8..772feca5f8 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -4,18 +4,8 @@ Import('env')
env.editor_sources = []
import os
-from compat import encode_utf8, byte_to_str, open_utf8
-
-def escape_string(s, encoding='ascii'):
- if isinstance(s, unicode):
- s = s.encode(encoding)
- result = ''
- for c in s:
- if not (32 <= ord(c) < 127) or c in ('\\', '"'):
- result += '\\%03o' % ord(c)
- else:
- result += c
- return result
+from compat import encode_utf8, byte_to_str, open_utf8, escape_string
+
def make_certs_header(target, source, env):
@@ -247,7 +237,7 @@ def make_license_header(target, source, env):
g.write("static const char *about_license =")
for line in f:
- escaped_string = escape_string(line.strip().replace("\"", "\\\""))
+ escaped_string = escape_string(line.strip())
g.write("\n\t\"" + escaped_string + "\\n\"")
g.write(";\n")
@@ -333,12 +323,12 @@ def make_license_header(target, source, env):
for k in j[0].split("\n"):
if file_body != "":
file_body += "\\n\"\n"
- escaped_string = escape_string(k.strip().replace("\"", "\\\""))
+ escaped_string = escape_string(k.strip())
file_body += "\t\"" + escaped_string
for k in j[1].split("\n"):
if copyright_body != "":
copyright_body += "\\n\"\n"
- escaped_string = escape_string(k.strip().replace("\"", "\\\""))
+ escaped_string = escape_string(k.strip())
copyright_body += "\t\"" + escaped_string
about_tp_file += "\t" + file_body + "\",\n"
@@ -353,7 +343,7 @@ def make_license_header(target, source, env):
for j in i[1].split("\n"):
if body != "":
body += "\\n\"\n"
- escaped_string = escape_string(j.strip().replace("\"", "\\\""))
+ escaped_string = escape_string(j.strip())
body += "\t\"" + escaped_string
about_license_name += "\t\"" + i[0] + "\",\n"