From 239e0c2b6254f7f408257172ef1f34f5c74f4ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Tue, 30 Dec 2025 16:50:32 +0100 Subject: [PATCH] fix(glsl2c.py): added a few missing things. - place "};\n" at the end of the array - remove Path() class to unnecessary variables such as dst --- glsl2c.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/glsl2c.py b/glsl2c.py index 24643c2..ed8cde5 100644 --- a/glsl2c.py +++ b/glsl2c.py @@ -2,21 +2,21 @@ import sys from pathlib import Path -if len(sys.argv) != 3 or not sys.argv[1].endswith((".glsl", ".vert", ".frag")): - sys.exit(1) +src = sys.argv[1] +dst = sys.argv[2] -src = Path(sys.argv[1]) -dst = Path(sys.argv[2]) +if len(sys.argv) != 3 or not src.endswith((".glsl", ".vert", ".frag")): + sys.exit(1) # variable name varname = src.replace("/", "_").replace(".", "_") # read to binary mode -content = src.read_bytes() +content = Path(src).read_bytes() line = 12 -with open(dst, "wb") as f: +with open(dst, "w") as f: # content array f.write(f"unsigned char {varname}[] = {{\n") @@ -30,6 +30,6 @@ with open(dst, "wb") as f: # LF/CRLF if (i + 1) % line == 0: f.write("\n") - + f.write("};\n") # content size f.write(f"unsigned int {varname}_len = {len(content)};") \ No newline at end of file