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.
master
voussoir 2020-08-23 22:21:36 -07:00
parent 1d97479f41
commit c0919242c2
1 changed files with 4 additions and 1 deletions

View File

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