From 731453ea8d3b065c6081da48982fa5354ac48b0a Mon Sep 17 00:00:00 2001 From: JoeLametta Date: Sun, 16 May 2021 17:19:14 +0000 Subject: [PATCH] Avoid useless './' in file paths Replaced useless 'os.path.relpath(os.getcwd())' statement with 'os.curdir' (which is equal to '.'). Signed-off-by: JoeLametta --- whipper/command/cd.py | 2 +- whipper/common/program.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/whipper/command/cd.py b/whipper/command/cd.py index 68b6d42..87060e2 100644 --- a/whipper/command/cd.py +++ b/whipper/command/cd.py @@ -280,7 +280,7 @@ Log files will log the path to tracks relative to this directory. "supports this feature. ") self.parser.add_argument('-O', '--output-directory', action="store", dest="output_directory", - default=os.path.relpath(os.getcwd()), + default=os.curdir, help="output directory; will be included " "in file paths in log") self.parser.add_argument('-W', '--working-directory', diff --git a/whipper/common/program.py b/whipper/common/program.py index 2ee4146..6f6102b 100644 --- a/whipper/common/program.py +++ b/whipper/common/program.py @@ -239,6 +239,8 @@ class Program: # Avoid filtering non str type values, replace None with empty string v_fltr = {k: self._filter.filter(v2) if isinstance(v2, str) else '' if v2 is None else v2 for k, v2 in v.items()} + if outdir == os.curdir: + return template % v_fltr # Avoid useless './' in file paths return os.path.join(outdir, template % v_fltr) @staticmethod