1
0
Fork 0

generate: container: Remove if ! [ -d dir ] from Environment.create

Remove the if ! [ -d {file.parent} ] check from Envrionment.create(), as
the directory has to exists, since the script checking if it exists also
is located in that directort...

Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
Enno Tensing 2025-07-22 13:08:30 +02:00
parent 995a66c753
commit 17adc701a8
Signed by: tenno
GPG key ID: 95265603BD36E66C

View file

@ -192,12 +192,7 @@ class Environment:
def create(self) -> str:
"""Create env file."""
file = Path(self.file)
cmd = f"# Create env-file {self.file}\n"
cmd += f"if ! [ -d '{file.parent}' ]\n"
cmd += "then\n"
cmd += f"\tmkdir --parents '{file.parent}'\n"
cmd += "fi\n"
for var in self.variables:
escaped_var = var.replace("'", "%b")
cmd += f"printf '{escaped_var}\\n' \"'\" >> '{self.file}'\n"