Attempts to move to the Trash on OS X, or the Recycle Bin on Windows. Also tries to find a suitable Trash location on Linux. If not possible, just deletes the file or folder instead. @param file the folder or file to be removed/deleted @return true if the folder was successfully removed @throws IOEx
(File file)
| 373 | * @throws IOException |
| 374 | */ |
| 375 | static public boolean deleteFile(File file) throws IOException { |
| 376 | FileUtils fu = FileUtils.getInstance(); |
| 377 | if (fu.hasTrash()) { |
| 378 | fu.moveToTrash(new File[] { file }); |
| 379 | return true; |
| 380 | |
| 381 | } else if (file.isDirectory()) { |
| 382 | Util.removeDir(file); |
| 383 | return true; |
| 384 | |
| 385 | } else { |
| 386 | return file.delete(); |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | |
| 391 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
no test coverage detected