From 897491e1594c6cd24cb063dd82f2c201679d0700 Mon Sep 17 00:00:00 2001 From: Dave Date: Sun, 21 Dec 2014 00:30:28 +0200 Subject: [PATCH] Added setup features for custom fileName --- src/nodash/core/spheres/NoHashSphereDefault.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/nodash/core/spheres/NoHashSphereDefault.java b/src/nodash/core/spheres/NoHashSphereDefault.java index fb7a55d..2470298 100644 --- a/src/nodash/core/spheres/NoHashSphereDefault.java +++ b/src/nodash/core/spheres/NoHashSphereDefault.java @@ -36,11 +36,20 @@ import nodash.models.NoUser; public final class NoHashSphereDefault implements NoHashSphereInterface { private Set database = Collections.newSetFromMap(new ConcurrentHashMap()); + private String fileName; + + public NoHashSphereDefault(String fileName) { + this.fileName = fileName; + } + + public NoHashSphereDefault() { + this.fileName = NoCore.config.databaseFilename; + } @SuppressWarnings("unchecked") public void setup() { if (NoCore.config.saveDatabase) { - File file = new File(NoCore.config.databaseFilename); + File file = new File(this.fileName); if (file.exists()) { try { byte[] data = Files.readAllBytes(file.toPath());