From 2fc55ee330a0bb2879db61c70bc921a0cd88c426 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 23 Aug 2020 22:17:50 -0700 Subject: [PATCH] Let RARCOMMAND take path and create derivatives by itself. --- rarpar.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rarpar.py b/rarpar.py index 5b88103..81be2fe 100644 --- a/rarpar.py +++ b/rarpar.py @@ -20,8 +20,8 @@ class NotEnoughSpace(RarParException): pass def RARCOMMAND( + path, basename, - input_pattern, workdir, password=None, rec=None, @@ -67,6 +67,11 @@ def RARCOMMAND( if password is not None: command.append(f'-hp{password}') + if path.is_dir: + input_pattern = path.absolute_path + '\\*' + else: + input_pattern = path.absolute_path + command.append(f'"{workdir.absolute_path}{os.sep}{basename}.rar"') command.append(f'"{input_pattern}"') @@ -234,11 +239,6 @@ def rarpar( path.assert_exists() - if path.is_dir: - input_pattern = path.absolute_path + '\\*' - else: - input_pattern = path.absolute_path - workdir = pathclass.Path(workdir) workdir.assert_is_directory() @@ -278,8 +278,8 @@ def rarpar( script = [] rarcommand = RARCOMMAND( + path=path, basename=basename, - input_pattern=input_pattern, password=password, rec=rec, rev=rev,