/** * Tries to find an existing user Trash folder and returns it. If no existing Trash folder was * found, creates the standard Xfce user Trash folder and returns it. * * @return the user Trash folder, <code>null</code> if no user trash folder could be found or * created */ private static AbstractFile getTrashFolder() { AbstractFile userHome = LocalFile.getUserHome(); AbstractFile trashDir = userHome.getChildSilently(".local/share/Trash/"); if (isTrashFolder(trashDir)) { return trashDir; } // No existing user trash was found: create the folder, only if it doesn't already exist. if (!trashDir.exists()) { try { trashDir.mkdirs(); trashDir.getChild("info").mkdir(); trashDir.getChild("files").mkdir(); return trashDir; } catch (IOException e) { // Will return null } } return null; }