scripts: twister: fix zephyr base sanitizing

If canonical zephyr base is already ended by trailing slash, then it
should not be added redundantly.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
This commit is contained in:
Piotr Golyzniak 2023-03-31 10:32:46 +02:00 committed by Carles Cufí
parent aac23e5bf7
commit 2fcfd48db2

View file

@ -847,7 +847,10 @@ class ProjectBuilder(FilterBuilder):
with open(file_path, "rt") as file:
data = file.read()
data = data.replace(canonical_zephyr_base+os.path.sep, "")
# add trailing slash at the end of canonical_zephyr_base if it does not exist:
path_to_remove = os.path.join(canonical_zephyr_base, "")
data = data.replace(path_to_remove, "")
with open(file_path, "wt") as file:
file.write(data)