Skip to content

Commit 8d23817

Browse files
committed
Make FileUtility#deleteFile(...) return boolean
1 parent def34f4 commit 8d23817

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/xyz/srnyx/javautilities/FileUtility.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ public class FileUtility {
2121
*
2222
* @param path the path to the file
2323
* @param silentFail if true, the error will be printed if the task fails
24+
*
25+
* @return true if the file was deleted, false otherwise
2426
*/
25-
public static void deleteFile(@NotNull Path path, boolean silentFail) {
27+
public static boolean deleteFile(@NotNull Path path, boolean silentFail) {
2628
try {
2729
Files.delete(path);
30+
return true;
2831
} catch (final IOException e) {
2932
if (!silentFail) e.printStackTrace();
33+
return false;
3034
}
3135
}
3236

0 commit comments

Comments
 (0)