Skip to content

Commit

Permalink
Make FileUtility#deleteFile(...) return boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
srnyx committed Jun 21, 2024
1 parent def34f4 commit 8d23817
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/xyz/srnyx/javautilities/FileUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ public class FileUtility {
*
* @param path the path to the file
* @param silentFail if true, the error will be printed if the task fails
*
* @return true if the file was deleted, false otherwise
*/
public static void deleteFile(@NotNull Path path, boolean silentFail) {
public static boolean deleteFile(@NotNull Path path, boolean silentFail) {
try {
Files.delete(path);
return true;
} catch (final IOException e) {
if (!silentFail) e.printStackTrace();
return false;
}
}

Expand Down

0 comments on commit 8d23817

Please sign in to comment.