mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-02 06:28:13 +01:00
Switched to use Files.delete
When File.delete fails, this boolean method simply returns false with no indication of the cause. On the other hand, when Files.delete fails, this void method returns one of a series of exception types to better indicate the cause of the failure. More information is generally better in a debugging situation, so I'll use this option.
This commit is contained in:
parent
08b2e2579b
commit
29d09922b9
@ -4,10 +4,12 @@ import java.beans.IntrospectionException;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -520,9 +522,12 @@ public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
File dataFolder = new File(plugin.getDataFolder(), DATABASE_FOLDER_NAME);
|
||||
File tableFolder = new File(dataFolder, dataObject.getSimpleName());
|
||||
if (tableFolder.exists()) {
|
||||
|
||||
File file = new File(tableFolder, fileName);
|
||||
if (!file.delete()) {
|
||||
plugin.getLogger().severe("Could not delete yaml database object! " + file.getName());
|
||||
try {
|
||||
Files.delete(file.toPath());
|
||||
} catch (IOException e) {
|
||||
plugin.getLogger().severe("Could not delete yaml database object! " + file.getName() + " - " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user