From ee9b7083501b94c9ff00ab1d7e481d6f8dec8b05 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Tue, 14 May 2019 17:47:04 +0200 Subject: [PATCH] Instance.init() --- src/be/nikiroo/fanfix/Instance.java | 16 +++++++++++++++- src/be/nikiroo/fanfix/Main.java | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index ef7799f..84a583e 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -42,7 +42,21 @@ public class Instance { private static TraceHandler tracer; private static TempFiles tempFiles; - static { + private static boolean init; + + /** + * Initialise the instance -- if already initialised, nothing will happen. + *

+ * Before calling this method, you may call {@link Bundles#getDirectory()} + * if wanted. + */ + static public void init() { + if (init) { + return; + } + + init = true; + // Before we can configure it: Boolean debug = checkEnv("DEBUG"); boolean trace = debug != null && debug; diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index c2f5891..b363361 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -87,6 +87,9 @@ public class Main { * see method description */ public static void main(String[] args) { + // Only one line, but very important: + Instance.init(); + String urlString = null; String luid = null; String sourceString = null; -- 2.27.0