Merge pull request #94995 from Repiteo/scons/raw-cstrings

SCons: Add method to generate raw cstrings
This commit is contained in:
Rémi Verschelde
2024-08-28 00:12:47 +02:00
11 changed files with 175 additions and 76 deletions

View File

@@ -15,12 +15,12 @@ def export_icon_builder(target, source, env):
src_path = Path(str(source[0]))
src_name = src_path.stem
platform = src_path.parent.parent.stem
with open(str(source[0]), "rb") as file:
svg = "".join([f"\\{hex(x)[1:]}" for x in file.read()])
with open(str(source[0]), "r") as file:
svg = file.read()
with methods.generated_wrapper(target, prefix=platform) as file:
file.write(
f"""\
static const char *_{platform}_{src_name}_svg = "{svg}";
static const char *_{platform}_{src_name}_svg = {methods.to_raw_cstring(svg)};
"""
)