Skip to content

Commit

Permalink
fix: Handle directory/file cases when removing files
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Oct 15, 2019
1 parent daea78d commit 14114c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/aria2p/api.py
Expand Up @@ -610,7 +610,10 @@ def remove_files(downloads, force=False):
for download in downloads:
if download.is_complete or force:
for path in download.root_files_paths:
shutil.rmtree(str(path))
if path.is_dir():
shutil.rmtree(str(path))
else:
path.unlink()
results.append(True)
else:
results.append(False)
Expand Down

0 comments on commit 14114c1

Please sign in to comment.