summaryrefslogtreecommitdiff
path: root/editor/SCsub
diff options
context:
space:
mode:
Diffstat (limited to 'editor/SCsub')
-rw-r--r--editor/SCsub33
1 files changed, 18 insertions, 15 deletions
diff --git a/editor/SCsub b/editor/SCsub
index 315865ad32..2b6494608b 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -4,7 +4,7 @@ Import('env')
env.editor_sources = []
import os
-from compat import encode_utf8, byte_to_str, open_utf8
+from compat import encode_utf8, byte_to_str, open_utf8, escape_string
def make_certs_header(target, source, env):
@@ -162,7 +162,7 @@ def make_authors_header(target, source, env):
for line in f:
if reading:
if line.startswith(" "):
- g.write("\t\"" + line.strip() + "\",\n")
+ g.write("\t\"" + escape_string(line.strip()) + "\",\n")
continue
if line.startswith("## "):
if reading:
@@ -170,7 +170,7 @@ def make_authors_header(target, source, env):
reading = False
for i in range(len(sections)):
if line.strip().endswith(sections[i]):
- current_section = sections_id[i]
+ current_section = escape_string(sections_id[i])
reading = True
g.write("static const char *" + current_section + "[] = {\n")
break
@@ -204,7 +204,7 @@ def make_donors_header(target, source, env):
for line in f:
if reading >= 0:
if line.startswith(" "):
- g.write("\t\"" + line.strip() + "\",\n")
+ g.write("\t\"" + escape_string(line.strip()) + "\",\n")
continue
if line.startswith("## "):
if reading:
@@ -212,7 +212,7 @@ def make_donors_header(target, source, env):
reading = False
for i in range(len(sections)):
if line.strip().endswith(sections[i]):
- current_section = sections_id[i]
+ current_section = escape_string(sections_id[i])
reading = True
g.write("static const char *" + current_section + "[] = {\n")
break
@@ -237,7 +237,8 @@ def make_license_header(target, source, env):
g.write("static const char *about_license =")
for line in f:
- g.write("\n\t\"" + line.strip().replace("\"", "\\\"") + "\\n\"")
+ escaped_string = escape_string(line.strip())
+ g.write("\n\t\"" + escaped_string + "\\n\"")
g.write(";\n")
@@ -322,11 +323,13 @@ def make_license_header(target, source, env):
for k in j[0].split("\n"):
if file_body != "":
file_body += "\\n\"\n"
- file_body += "\t\"" + 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"
- copyright_body += "\t\"" + k.strip().replace("\"", "\\\"")
+ escaped_string = escape_string(k.strip())
+ copyright_body += "\t\"" + escaped_string
about_tp_file += "\t" + file_body + "\",\n"
about_tp_copyright += "\t" + copyright_body + "\",\n"
@@ -340,7 +343,8 @@ def make_license_header(target, source, env):
for j in i[1].split("\n"):
if body != "":
body += "\\n\"\n"
- body += "\t\"" + j.strip().replace("\"", "\\\"")
+ escaped_string = escape_string(j.strip())
+ body += "\t\"" + escaped_string
about_license_name += "\t\"" + i[0] + "\",\n"
about_license_body += "\t" + body + "\",\n"
@@ -395,8 +399,8 @@ def _make_doc_data_class_path(to_path):
g.write("{NULL,NULL}\n")
g.write("};\n")
-if (env["tools"] == "yes"):
+if env['tools']:
# Register exporters
reg_exporters_inc = '#include "register_exporters.h"\n'
reg_exporters = 'void register_exporters() {\n'
@@ -411,12 +415,11 @@ if (env["tools"] == "yes"):
f.close()
# API documentation
- docs=[]
- print("cdir is: "+env.Dir('#').abspath)
- for f in os.listdir(os.path.join(env.Dir('#').abspath,"doc/classes")):
- docs.append("#doc/classes/"+f)
+ docs = []
+ for f in os.listdir(os.path.join(env.Dir('#').abspath, "doc/classes")):
+ docs.append("#doc/classes/" + f)
- _make_doc_data_class_path(os.path.join(env.Dir('#').abspath,"editor/doc"))
+ _make_doc_data_class_path(os.path.join(env.Dir('#').abspath, "editor/doc"))
env.Depends("#editor/doc_data_compressed.gen.h", docs)
env.Command("#editor/doc_data_compressed.gen.h", docs, make_doc_header)