From: Niki Roo Date: Sat, 18 May 2019 16:07:54 +0000 (+0200) Subject: allow force-init X-Git-Tag: fanfix-3.0.0~32 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=6a211e41dfcf8f187caf29a307fc9ae983ad4d57;p=fanfix.git allow force-init --- diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index 8a2ed98..96d5d6f 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -47,11 +47,32 @@ public class Instance { /** * Initialise the instance -- if already initialised, nothing will happen. *

- * Before calling this method, you may call {@link Bundles#setDirectory()} - * if wanted. + * Before calling this method, you may call + * {@link Bundles#setDirectory(String)} if wanted. */ static public void init() { - if (init) { + init(false); + } + + /** + * Initialise the instance -- if already initialised, nothing will happen + * unless you pass TRUE to force. + *

+ * Before calling this method, you may call + * {@link Bundles#setDirectory(String)} if wanted. + *

+ * Note: forcing the initialisation can be dangerous, so make sure to only + * make it under controlled circumstances -- for instance, at the start of + * the program, you could call {@link Instance#init()}, change some settings + * because you want to force those settings (it will also forbid users to + * change them!) and then call {@link Instance#init(boolean)} with + * force set to TRUE. + * + * @param force + * force the initialisation even if already initialised + */ + static public void init(boolean force) { + if (init && !force) { return; }