feat: move to trash instead of deleting permanently when deleting files

This commit is contained in:
2026-04-07 23:44:38 +02:00
parent 7526eb5d30
commit 75c649afda
2 changed files with 2 additions and 4 deletions
+1
View File
@@ -9,3 +9,4 @@ plyer==2.1.0
psutil==7.1.0 psutil==7.1.0
libtorrent==2.0.11 libtorrent==2.0.11
libtorrent-windows-dll==0.0.3 libtorrent-windows-dll==0.0.3
send2trash==2.1.0
+1 -4
View File
@@ -134,14 +134,11 @@ class ContextMenu_Downloads:
except Exception as e: except Exception as e:
consoleLog(f"Exception while removing download from LibTorrent: {e}") consoleLog(f"Exception while removing download from LibTorrent: {e}")
if download_path and os.path.exists(download_path): if download_path and os.path.exists(download_path):
import shutil
last_error = None last_error = None
for attempt in range(3): for attempt in range(3):
try: try:
if os.path.isfile(download_path): if os.path.isfile(download_path):
os.remove(download_path) send2trash(download_path)
else:
shutil.rmtree(download_path)
consoleLog(f"Deleted files for: {torrent_name}", True) consoleLog(f"Deleted files for: {torrent_name}", True)
last_error = None last_error = None
break break