From: Niki Roo Date: Tue, 14 May 2019 15:47:04 +0000 (+0200) Subject: Instance.init() X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=ee9b7083501b94c9ff00ab1d7e481d6f8dec8b05;p=nikiroo-utils.git Instance.init() --- 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;