Now we use the realpath instead of the user provided name

Helps to avoid unpleasant surprises like in the #544 case

Closes #544
This commit is contained in:
Salvador E. Tropea 2024-01-02 10:48:06 -03:00
parent f28540d9cc
commit e4614e7603
2 changed files with 2 additions and 2 deletions

View File

@ -443,7 +443,7 @@ def preflight_checks(skip_pre, targets):
def get_output_dir(o_dir, obj, dry=False): def get_output_dir(o_dir, obj, dry=False):
# outdir is a combination of the config and output # outdir is a combination of the config and output
outdir = os.path.abspath(obj.expand_dirname(os.path.join(GS.out_dir, o_dir))) outdir = os.path.realpath(os.path.abspath(obj.expand_dirname(os.path.join(GS.out_dir, o_dir))))
# Create directory if needed # Create directory if needed
logger.debug("Output destination: {}".format(outdir)) logger.debug("Output destination: {}".format(outdir))
if not dry and not os.path.exists(outdir): if not dry and not os.path.exists(outdir):

View File

@ -194,7 +194,7 @@ class BaseOutput(RegOutput):
def run(self, output_dir): def run(self, output_dir):
self.output_dir = output_dir self.output_dir = output_dir
output = self.options.output if hasattr(self.options, 'output') else '' output = self.options.output if hasattr(self.options, 'output') else ''
target = self.expand_filename(output_dir, output) target = os.path.realpath(self.expand_filename(output_dir, output))
# Ensure the destination dir already exists # Ensure the destination dir already exists
target_dir = os.path.dirname(os.path.abspath(target)) target_dir = os.path.dirname(os.path.abspath(target))
if not os.path.isdir(target_dir): if not os.path.isdir(target_dir):