mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
feat: move to trash instead of deleting permanently when deleting files
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user