/**
* Initialise the instance -- if already initialised, nothing will happen.
* <p>
- * Before calling this method, you may call {@link Bundles#setDirectory(String)}
- * if wanted.
+ * Before calling this method, you may call
+ * {@link Bundles#setDirectory(String)} if wanted.
+ * <p>
+ * Note that this method will honour some environment variables, the 3 most
+ * important ones probably being:
+ * <ul>
+ * <li><tt>DEBUG</tt>: will enable DEBUG output if set to 1 (or Y or TRUE or
+ * ON, case insensitive)</li>
+ * <li><tt>CONFIG_DIR</tt>: will use this directory as configuration
+ * directory (supports $HOME notation, defaults to $HOME/.fanfix</li>
+ * <li><tt>BOOKS_DIR</tt>: will use this directory as library directory
+ * (supports $HOME notation, defaults to $HOME/Books</li>
+ * </ul>
*/
static public void init() {
init(false);
BasicLibrary lib = null;
boolean useRemote = config.getBoolean(Config.REMOTE_LIBRARY_ENABLED, false);
-
if (useRemote) {
String host = null;
int port = -1;
public class Main {
public static void main(String[] args) {
- UIUtils.setLookAndFeel();
-
- final String forceLib = null;
- // = "$HOME/Books/local";
-
- if (forceLib == null) {
- Instance.init();
- } else {
- Instance.init(new Instance() {
- private DataLoader cache;
- private BasicLibrary lib;
-
- @Override
- public DataLoader getCache() {
- if (cache == null) {
- cache = new DataLoader(getConfig()
- .getString(Config.NETWORK_USER_AGENT));
- }
-
- return cache;
- }
-
- @Override
- public BasicLibrary getLibrary() {
- if (lib == null) {
- lib = new LocalLibrary(getFile(forceLib), getConfig()) {
- };
- }
-
- return lib;
- }
- });
+ // Defer to main application if parameters (we are only a UI)
+ // (though we could handle some of the parameters in the future,
+ // maybe importing via ImporterFrame? but that would require a
+ // unique instance of the UI to be usable...)
+ if (args != null && args.length > 0) {
+ be.nikiroo.fanfix.Main.main(args);
+ return;
}
+ UIUtils.setLookAndFeel();
+ Instance.init();
+
JFrame main = new MainFrame(true, true);
main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
main.setVisible(true);