Is there a cross-platform way to move files to trash? file delete deletes the file completely and is not undoable on unixen. Even on Linux alone it's not straight forward to figure out the trash directory because it often depends on the file manager.
I've resorted to doing:
exec gio trash $file
The problem is that this only works on Gnome so even on Linux it is not cross-platform.
And as I don't have a Windows machine, figuring out how trash/recycle bin works in Windows is even more difficult