Make sure to avoid java.awt.HeadlessException if Desktop.moveToTrash() is called on headless Linux devices (possible issue breaking -revert on some Linux devices)

This commit is contained in:
Reinhard Pointner 2018-09-20 20:39:53 +07:00
parent 507e1c5df9
commit b48da1a48c
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ public class UserFiles {
public static void trash(File file) throws IOException {
// use system trash if possible
if (Desktop.getDesktop().isSupported(Desktop.Action.MOVE_TO_TRASH)) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.MOVE_TO_TRASH)) {
try {
if (Desktop.getDesktop().moveToTrash(file)) {
return;