Added config file existence check

This commit is contained in:
PeratX 2017-06-10 19:55:37 +08:00
parent 2a04f3a29b
commit 0afb7553a9
3 changed files with 9 additions and 7 deletions

View File

@ -52,7 +52,7 @@ dependencies {
compile 'org.pcap4j:pcap4j-core:1.7.0'
compile 'org.pcap4j:pcap4j-packetfactory-propertiesbased:1.7.0'
compile 'de.measite.minidns:minidns-core:0.2.1'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.google.firebase:firebase-crash:10.2.6'

View File

@ -125,12 +125,14 @@ public class Configurations {
public static Configurations load(File file) {
Configurations.file = file;
Configurations config = null;
if (file.exists()) {
try {
config = Daedalus.parseJson(Configurations.class, new JsonReader(new FileReader(file)));
Logger.info("Loading configuration successfully from " + file);
} catch (Exception e) {
Logger.logException(e);
}
}
if (config == null) {
config = new Configurations();