summaryrefslogtreecommitdiff
path: root/methods.py
diff options
context:
space:
mode:
Diffstat (limited to 'methods.py')
-rw-r--r--methods.py44
1 files changed, 24 insertions, 20 deletions
diff --git a/methods.py b/methods.py
index 99a59b49e3..dddac9bd86 100644
--- a/methods.py
+++ b/methods.py
@@ -111,6 +111,10 @@ def get_version_info(module_version_string="", silent=False):
head = open(os.path.join(gitfolder, "HEAD"), "r", encoding="utf8").readline().strip()
if head.startswith("ref: "):
ref = head[5:]
+ # If this directory is a Git worktree instead of a root clone.
+ parts = gitfolder.split("/")
+ if len(parts) > 2 and parts[-2] == "worktrees":
+ gitfolder = "/".join(parts[0:-2])
head = os.path.join(gitfolder, ref)
packedrefs = os.path.join(gitfolder, "packed-refs")
if os.path.isfile(head):
@@ -484,29 +488,29 @@ def use_windows_spawn_fix(self, platform=None):
def save_active_platforms(apnames, ap):
for x in ap:
- names = ["logo"]
- if os.path.isfile(x + "/run_icon.png"):
- names.append("run_icon")
-
- for name in names:
- pngf = open(x + "/" + name + ".png", "rb")
- b = pngf.read(1)
- str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
- str += " static const unsigned char _" + x[9:] + "_" + name + "[]={"
+ svg_names = []
+ if os.path.isfile(x + "/logo.svg"):
+ svg_names.append("logo")
+ if os.path.isfile(x + "/run_icon.svg"):
+ svg_names.append("run_icon")
+
+ for name in svg_names:
+ svgf = open(x + "/" + name + ".svg", "rb")
+ b = svgf.read(1)
+ svg_str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
+ svg_str += " static const char *_" + x[9:] + "_" + name + '_svg = "'
while len(b) == 1:
- str += hex(ord(b))
- b = pngf.read(1)
- if len(b) == 1:
- str += ","
+ svg_str += "\\" + hex(ord(b))[1:]
+ b = svgf.read(1)
- str += "};\n"
+ svg_str += '";\n'
- pngf.close()
+ svgf.close()
# NOTE: It is safe to generate this file here, since this is still executed serially
- wf = x + "/" + name + ".gen.h"
- with open(wf, "w") as pngw:
- pngw.write(str)
+ wf = x + "/" + name + "_svg.gen.h"
+ with open(wf, "w") as svgw:
+ svgw.write(svg_str)
def no_verbose(sys, env):
@@ -728,7 +732,7 @@ def add_to_vs_project(env, sources):
env.vs_srcs += [basename + ".cpp"]
-def generate_vs_project(env, num_jobs):
+def generate_vs_project(env, num_jobs, project_name="godot"):
batch_file = find_visual_c_batch_file(env)
if batch_file:
@@ -869,7 +873,7 @@ def generate_vs_project(env, num_jobs):
env["MSVS"]["PROJECTSUFFIX"] = ".vcxproj"
env["MSVS"]["SOLUTIONSUFFIX"] = ".sln"
env.MSVSProject(
- target=["#godot" + env["MSVSPROJECTSUFFIX"]],
+ target=["#" + project_name + env["MSVSPROJECTSUFFIX"]],
incs=env.vs_incs,
srcs=env.vs_srcs,
auto_build_solution=1,