summaryrefslogtreecommitdiffstats
path: root/glsl_builders.py
diff options
context:
space:
mode:
Diffstat (limited to 'glsl_builders.py')
-rw-r--r--glsl_builders.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/glsl_builders.py b/glsl_builders.py
index fd90e9a6c0..05aab3acbb 100644
--- a/glsl_builders.py
+++ b/glsl_builders.py
@@ -1,7 +1,9 @@
"""Functions used to generate source files during build time"""
import os.path
-from typing import Optional, Iterable
+from typing import Iterable, Optional
+
+from methods import print_error
def generate_inline_code(input_lines: Iterable[str], insert_newline: bool = True):
@@ -38,7 +40,7 @@ class RDHeaderStruct:
def include_file_in_rd_header(filename: str, header_data: RDHeaderStruct, depth: int) -> RDHeaderStruct:
- with open(filename, "r") as fs:
+ with open(filename, "r", encoding="utf-8") as fs:
line = fs.readline()
while line:
@@ -76,18 +78,18 @@ def include_file_in_rd_header(filename: str, header_data: RDHeaderStruct, depth:
else:
included_file = os.path.relpath(os.path.dirname(filename) + "/" + includeline)
- if not included_file in header_data.vertex_included_files and header_data.reading == "vertex":
+ if included_file not in header_data.vertex_included_files and header_data.reading == "vertex":
header_data.vertex_included_files += [included_file]
if include_file_in_rd_header(included_file, header_data, depth + 1) is None:
- print("Error in file '" + filename + "': #include " + includeline + "could not be found!")
- elif not included_file in header_data.fragment_included_files and header_data.reading == "fragment":
+ print_error(f'In file "{filename}": #include "{includeline}" could not be found!"')
+ elif included_file not in header_data.fragment_included_files and header_data.reading == "fragment":
header_data.fragment_included_files += [included_file]
if include_file_in_rd_header(included_file, header_data, depth + 1) is None:
- print("Error in file '" + filename + "': #include " + includeline + "could not be found!")
- elif not included_file in header_data.compute_included_files and header_data.reading == "compute":
+ print_error(f'In file "{filename}": #include "{includeline}" could not be found!"')
+ elif included_file not in header_data.compute_included_files and header_data.reading == "compute":
header_data.compute_included_files += [included_file]
if include_file_in_rd_header(included_file, header_data, depth + 1) is None:
- print("Error in file '" + filename + "': #include " + includeline + "could not be found!")
+ print_error(f'In file "{filename}": #include "{includeline}" could not be found!"')
line = fs.readline()
@@ -172,7 +174,7 @@ class RAWHeaderStruct:
def include_file_in_raw_header(filename: str, header_data: RAWHeaderStruct, depth: int) -> None:
- with open(filename, "r") as fs:
+ with open(filename, "r", encoding="utf-8") as fs:
line = fs.readline()
while line: