diff options
| author | yum <yum.food.vr@gmail.com> | 2023-08-10 13:48:08 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-08-10 13:51:33 -0700 |
| commit | 5f33e4efdaa5cdb3773d7eb111b1f74b74721f29 (patch) | |
| tree | 5788859cbf0dbfa721241eab9118990f3c39beb8 /Scripts/generate_shader.py | |
| parent | 4337cb33939e43af1ed479bf87cb9390bcbae8b1 (diff) | |
Fix user-reported bug in generate_shader.py
Specify file encoding when generating shaders.
Diffstat (limited to 'Scripts/generate_shader.py')
| -rw-r--r-- | Scripts/generate_shader.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Scripts/generate_shader.py b/Scripts/generate_shader.py index 2348141..80f6704 100644 --- a/Scripts/generate_shader.py +++ b/Scripts/generate_shader.py @@ -100,7 +100,7 @@ def generateLetterAccessor(nbytes: int, nrows: int, ncols: int, prefix: str = "" def applyLineMacro(old_path: str, new_path: str, macro: str, replacement: str) -> bool: new_lines = [] times_applied = 0 - with open(old_path, 'r') as f: + with open(old_path, 'r', encoding="utf-8") as f: for line in f: if line[-1] == '\n': line = line[0:len(line)-1] @@ -109,13 +109,11 @@ def applyLineMacro(old_path: str, new_path: str, macro: str, replacement: str) - times_applied += 1 else: new_lines.append(line) - with open(new_path, 'w') as f: + with open(new_path, 'w', encoding="utf-8") as f: f.write('\n'.join(new_lines)) return times_applied if __name__ == "__main__": - sys.stdout.reconfigure(encoding="utf-8") - print("args: {}".format(" ".join(sys.argv))) parser = argparse.ArgumentParser() |
