private static File readerTmp;
static {
- // Most of the rest is dependant upon this:
+ // Most of the rest is dependent upon this:
config = new ConfigBundle();
trans = new StringIdBundle(getLang());
}
String configDir = System.getenv("CONFIG_DIR");
+ if (configDir == null) {
+ configDir = new File(System.getProperty("user.home"), ".fanfix")
+ .getPath();
+ }
if (configDir != null) {
- if (new File(configDir).isDirectory()) {
- Bundles.setDirectory(configDir);
- try {
- config = new ConfigBundle();
- config.updateFile(configDir);
- } catch (IOException e) {
- syserr(e);
- }
- try {
- trans = new StringIdBundle(getLang());
- trans.updateFile(configDir);
- } catch (IOException e) {
- syserr(e);
- }
+ if (!new File(configDir).exists()) {
+ new File(configDir).mkdirs();
} else {
- syserr(new IOException("Configuration directory not found: "
- + configDir));
+ Bundles.setDirectory(configDir);
}
+
+ try {
+ config = new ConfigBundle();
+ config.updateFile(configDir);
+ } catch (IOException e) {
+ syserr(e);
+ }
+ try {
+ trans = new StringIdBundle(getLang());
+ trans.updateFile(configDir);
+ } catch (IOException e) {
+ syserr(e);
+ }
+
+ Bundles.setDirectory(configDir);
}
try {
import java.io.IOException;
import java.io.Writer;
+import be.nikiroo.utils.resources.Bundle;
import be.nikiroo.utils.resources.Meta;
-import be.nikiroo.utils.resources.bundles.Bundle;
/**
* The {@link Enum} representing textual information to be translated to the
public static BasicReader getReader() {
if (defaultType != null) {
switch (defaultType) {
- // case LOCAL:
- // return new LocalReader().setType(ReaderType.LOCAL);
+ //case LOCAL:
+ //return new LocalReader().setType(ReaderType.LOCAL);
case CLI:
return new CliReader().setType(ReaderType.CLI);
}