Only add -r recurse flag if input path is directory.

I discovered an issue when the input path was a file, winrar was trying
to access a sibling directory (particularly $recycle.bin while on drive
root) and raising permission denied errors.
This commit is contained in:
voussoir 2020-08-23 22:21:36 -07:00
parent 1d97479f41
commit c0919242c2

View file

@ -52,7 +52,7 @@ def RARCOMMAND(
''' '''
command = [ command = [
'winrar', 'winrar',
'a -ibck -ma -m0 -mt1 -ri1:30 -r -ep1', 'a -ibck -ma -m0 -mt1 -ri1:30 -ep1',
'-y -xthumbs.db -xdesktop.ini', '-y -xthumbs.db -xdesktop.ini',
] ]
if volume is not None: if volume is not None:
@ -67,6 +67,9 @@ 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:
command.append('-r')
if path.is_dir: if path.is_dir:
input_pattern = path.absolute_path + '\\*' input_pattern = path.absolute_path + '\\*'
else: else: