1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Removed buggy redundant check in FileUtils.deleteIfExists()

The documentation for File.delete() says that the method return true
if the the file is successfully deleted, otherwise false is returned.
An exception is thrown only when the file is not accessible (for
permission problem).

Removing the extra check solves another problem, for example in a
folder with the following situation:

    linkToFileA -> FileA
    FileA

if we remove FileA, we remain with a broken link that can't be removed
using FileUtils.deleteIfExists() because calling File.exists() on a
broken link returns *false*. This commit solve this problem.
This commit is contained in:
Cristian Maglie 2015-05-14 19:18:24 +02:00
parent d57681c442
commit 956ddda98e

View File

@ -274,10 +274,6 @@ public class FileUtils {
return true;
}
if (!file.exists()) {
return false;
}
return file.delete();
}