From 3b356ef774611edeb8ef2ba020e7087931a1142e Mon Sep 17 00:00:00 2001 From: Dave Date: Sun, 21 Dec 2014 17:21:24 +0200 Subject: [PATCH] Fixed interactions with old config setups --- src/nodash/core/spheres/NoHashSphereDefault.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/nodash/core/spheres/NoHashSphereDefault.java b/src/nodash/core/spheres/NoHashSphereDefault.java index 71c27a7..b5d63dc 100644 --- a/src/nodash/core/spheres/NoHashSphereDefault.java +++ b/src/nodash/core/spheres/NoHashSphereDefault.java @@ -14,6 +14,8 @@ * limitations under the License. * * The NoHashSpehre stores database hashes for user verification. + * + * Must be used with something that uses NoConfigDefault or an extension. */ package nodash.core.spheres; @@ -31,6 +33,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import nodash.core.NoCore; +import nodash.core.NoConfigDefault; import nodash.exceptions.NoDashFatalException; import nodash.models.NoUser; @@ -43,12 +46,12 @@ public final class NoHashSphereDefault implements NoHashSphereInterface { } public NoHashSphereDefault() { - this.fileName = NoCore.config.databaseFilename; + this.fileName = ( (NoConfigDefault) NoCore.config).getDatabaseName(); } @SuppressWarnings("unchecked") public void setup() { - if (NoCore.config.saveDatabase) { + if (NoCore.config.saveDatabase()) { File file = new File(this.fileName); if (file.exists()) { try { @@ -74,7 +77,7 @@ public final class NoHashSphereDefault implements NoHashSphereInterface { byte[] data = baos.toByteArray(); oos.close(); baos.close(); - File file = new File(NoCore.config.databaseFilename); + File file = new File( ( (NoConfigDefault) NoCore.config).getDatabaseName()); Files.write(file.toPath(), data, StandardOpenOption.CREATE); }