+ private static void createConfigs(String configDir, boolean refresh) {
+ if (!refresh) {
+ Bundles.setDirectory(configDir);
+ }
+
+ try {
+ config = new ConfigBundle();
+ config.updateFile(configDir);
+ } catch (IOException e) {
+ tracer.error(e);
+ }
+
+ try {
+ uiconfig = new UiConfigBundle();
+ uiconfig.updateFile(configDir);
+ } catch (IOException e) {
+ tracer.error(e);
+ }
+
+ // No updateFile for this one! (we do not want the user to have custom
+ // translations that won't accept updates from newer versions)
+ trans = new StringIdBundle(getLang());
+ transGui = new StringIdGuiBundle(getLang());
+
+ // Fix an old bug (we used to store custom translation files by
+ // default):
+ if (trans.getString(StringId.INPUT_DESC_CBZ) == null) {
+ trans.deleteFile(configDir);
+ }
+
+ if (checkEnv("NOUTF")) {
+ trans.setUnicode(false);
+ transGui.setUnicode(false);
+ }
+
+ Bundles.setDirectory(configDir);
+ }
+
+ /**
+ * Create the default library as specified by the config.
+ *
+ * @param remoteDir
+ * the base remote directory if needed
+ *
+ * @return the default {@link BasicLibrary}
+ */
+ private static BasicLibrary createDefaultLibrary(File remoteDir) {
+ BasicLibrary lib = null;
+
+ String remoteLib = config.getString(Config.DEFAULT_LIBRARY);
+ if (remoteLib == null || remoteLib.trim().isEmpty()) {
+ String libDir = System.getProperty("fanfix.libdir");
+ if (libDir == null || libDir.isEmpty()) {
+ libDir = config.getString(Config.LIBRARY_DIR);
+ }
+ try {
+ lib = new LocalLibrary(getFile(libDir));
+ } catch (Exception e) {
+ tracer.error(new IOException(
+ "Cannot create library for directory: "
+ + getFile(libDir), e));
+ }