diff --git a/requirements.txt b/requirements.txt index 0fecfdd..fa53177 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ plyer==2.1.0 psutil==7.1.0 libtorrent==2.0.11 libtorrent-windows-dll==0.0.3 +send2trash==2.1.0 diff --git a/src/interface/dialogs/contextmenu.py b/src/interface/dialogs/contextmenu.py index 327b7ba..837e1a1 100644 --- a/src/interface/dialogs/contextmenu.py +++ b/src/interface/dialogs/contextmenu.py @@ -134,14 +134,11 @@ class ContextMenu_Downloads: except Exception as e: consoleLog(f"Exception while removing download from LibTorrent: {e}") if download_path and os.path.exists(download_path): - import shutil last_error = None for attempt in range(3): try: if os.path.isfile(download_path): - os.remove(download_path) - else: - shutil.rmtree(download_path) + send2trash(download_path) consoleLog(f"Deleted files for: {torrent_name}", True) last_error = None break