Remove glsl file is fixing it fails

This commit is contained in:
Kovid Goyal
2026-07-02 14:35:54 +05:30
parent 98082a1b37
commit 23ae27901b

View File

@@ -441,11 +441,15 @@ def fixup_opengl_code(glsl_code: str, path: str) -> tuple[str, dict[str, Any]]:
def fixup_opengl_files(*paths: str) -> None:
' Convert the GLSL output of slangc to something that will work with OpenGL 3.3 '
' Convert the GLSL output of slangc to something that will work with OpenGL 3.1 '
for path in paths:
with open(path, 'r+') as f:
glsl_code = f.read()
fixed, metadata = fixup_opengl_code(glsl_code, path)
try:
fixed, metadata = fixup_opengl_code(glsl_code, path)
except Exception:
os.unlink(path)
raise
f.seek(0)
f.truncate()
f.write(fixed)