Let RARCOMMAND take path and create derivatives by itself.

This commit is contained in:
voussoir 2020-08-23 22:17:50 -07:00
parent 983d4ddc1e
commit 2fc55ee330

View file

@ -20,8 +20,8 @@ class NotEnoughSpace(RarParException):
pass pass
def RARCOMMAND( def RARCOMMAND(
path,
basename, basename,
input_pattern,
workdir, workdir,
password=None, password=None,
rec=None, rec=None,
@ -67,6 +67,11 @@ def RARCOMMAND(
if password is not None: if password is not None:
command.append(f'-hp{password}') 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'"{workdir.absolute_path}{os.sep}{basename}.rar"')
command.append(f'"{input_pattern}"') command.append(f'"{input_pattern}"')
@ -234,11 +239,6 @@ def rarpar(
path.assert_exists() path.assert_exists()
if path.is_dir:
input_pattern = path.absolute_path + '\\*'
else:
input_pattern = path.absolute_path
workdir = pathclass.Path(workdir) workdir = pathclass.Path(workdir)
workdir.assert_is_directory() workdir.assert_is_directory()
@ -278,8 +278,8 @@ def rarpar(
script = [] script = []
rarcommand = RARCOMMAND( rarcommand = RARCOMMAND(
path=path,
basename=basename, basename=basename,
input_pattern=input_pattern,
password=password, password=password,
rec=rec, rec=rec,
rev=rev, rev=rev,