From 5ebf72c44c0f0768b9d777e7894acbad24fcd9e1 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 21 Nov 2022 00:00:22 +0200 Subject: [PATCH] util/glsl2spirv: don't store preprocessed files in source tree Signed-off-by: Lionel Landwerlin Reviewed-by: Dylan Baker Part-of: --- src/util/glsl2spirv.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/glsl2spirv.py b/src/util/glsl2spirv.py index 8a1fba2..dbe53e5 100644 --- a/src/util/glsl2spirv.py +++ b/src/util/glsl2spirv.py @@ -125,8 +125,8 @@ def postprocess_file(args: Arguments) -> None: w.writelines(lines) -def preprocess_file(args: Arguments, origin_file: T.TextIO) -> str: - with open(origin_file.name + ".copy", "w") as copy_file: +def preprocess_file(args: Arguments, origin_file: T.TextIO, directory: os.PathLike) -> str: + with open(os.path.join(directory, os.path.basename(origin_file.name)), "w") as copy_file: lines = origin_file.readlines() if args.create_entry is not None: @@ -142,7 +142,8 @@ def preprocess_file(args: Arguments, origin_file: T.TextIO) -> str: def process_file(args: Arguments) -> None: with open(args.input, "r") as infile: - copy_file = preprocess_file(args, infile) + copy_file = preprocess_file(args, infile, + os.path.dirname(args.output)) cmd_list = [args.glslang] -- 2.7.4