parent
8b6e501c2e
commit
1324356827
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,4 +1 @@
|
|||||||
/target/
|
/target/
|
||||||
/localDB/
|
|
||||||
/log/
|
|
||||||
/themes.ser
|
|
@ -32,7 +32,7 @@ public class Config {
|
|||||||
items.put("port", new ConfigItem<>("port", "p", (input) -> Integer.parseInt(input), null));
|
items.put("port", new ConfigItem<>("port", "p", (input) -> Integer.parseInt(input), null));
|
||||||
items.put("localDB", new ConfigItem<>("localDB", "db", (input) -> new File(input), new File("localDB")));
|
items.put("localDB", new ConfigItem<>("localDB", "db", (input) -> new File(input), new File("localDB")));
|
||||||
items.put("syncTimeout", new ConfigItem<>("syncTimeout", "st", (input) -> Integer.parseInt(input), 1000));
|
items.put("syncTimeout", new ConfigItem<>("syncTimeout", "st", (input) -> Integer.parseInt(input), 1000));
|
||||||
items.put("homeDirectory", new ConfigItem<>("homeDirectory", "h", (input) -> new File(input), new File(System.getProperty("user.home"))));
|
items.put("homeDirectory", new ConfigItem<>("homeDirectory", "h", (input) -> new File(input), new File(System.getProperty("user.home"), ".envoy")));
|
||||||
items.put("fileLevelBarrier", new ConfigItem<>("fileLevelBarrier", "fb", (input) -> Level.parse(input), Level.CONFIG));
|
items.put("fileLevelBarrier", new ConfigItem<>("fileLevelBarrier", "fb", (input) -> Level.parse(input), Level.CONFIG));
|
||||||
items.put("consoleLevelBarrier", new ConfigItem<>("consoleLevelBarrier", "cb", (input) -> Level.parse(input), Level.FINEST));
|
items.put("consoleLevelBarrier", new ConfigItem<>("consoleLevelBarrier", "cb", (input) -> Level.parse(input), Level.FINEST));
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class Settings {
|
|||||||
/**
|
/**
|
||||||
* User-defined themes are stored inside this file.
|
* User-defined themes are stored inside this file.
|
||||||
*/
|
*/
|
||||||
private File themeFile = new File("themes.ser");
|
private File themeFile = new File(Config.getInstance().getHomeDirectory(), "themes.ser");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton instance of this class.
|
* Singleton instance of this class.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package envoy.client.ui;
|
package envoy.client.ui;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -8,10 +9,7 @@ import java.util.logging.Logger;
|
|||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import envoy.client.Client;
|
import envoy.client.*;
|
||||||
import envoy.client.Config;
|
|
||||||
import envoy.client.LocalDB;
|
|
||||||
import envoy.client.Settings;
|
|
||||||
import envoy.client.util.EnvoyLog;
|
import envoy.client.util.EnvoyLog;
|
||||||
import envoy.exception.EnvoyException;
|
import envoy.exception.EnvoyException;
|
||||||
import envoy.schema.User;
|
import envoy.schema.User;
|
||||||
@ -62,8 +60,8 @@ public class Startup {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
EnvoyLog.setFileLevelBarrier(Config.getInstance().getFileLevelBarrier());
|
EnvoyLog.setFileLevelBarrier(config.getFileLevelBarrier());
|
||||||
EnvoyLog.setConsoleLevelBarrier(Config.getInstance().getConsoleLevelBarrier());
|
EnvoyLog.setConsoleLevelBarrier(config.getConsoleLevelBarrier());
|
||||||
|
|
||||||
// Ask the user for their user name
|
// Ask the user for their user name
|
||||||
String userName = JOptionPane.showInputDialog("Please enter your username");
|
String userName = JOptionPane.showInputDialog("Please enter your username");
|
||||||
@ -75,7 +73,7 @@ public class Startup {
|
|||||||
// Initialize the local database
|
// Initialize the local database
|
||||||
LocalDB localDB;
|
LocalDB localDB;
|
||||||
try {
|
try {
|
||||||
localDB = new LocalDB(config.getLocalDB());
|
localDB = new LocalDB(new File(config.getHomeDirectory(), config.getLocalDB().getPath()));
|
||||||
} catch (IOException e3) {
|
} catch (IOException e3) {
|
||||||
logger.log(Level.SEVERE, "Could not initialize local database", e3);
|
logger.log(Level.SEVERE, "Could not initialize local database", e3);
|
||||||
JOptionPane.showMessageDialog(null, "Could not initialize local database!\n" + e3.toString());
|
JOptionPane.showMessageDialog(null, "Could not initialize local database!\n" + e3.toString());
|
||||||
|
@ -31,7 +31,7 @@ public class EnvoyLog {
|
|||||||
// Get a logger with the specified name
|
// Get a logger with the specified name
|
||||||
Logger logger = Logger.getLogger(name);
|
Logger logger = Logger.getLogger(name);
|
||||||
|
|
||||||
final String logPath = "log/envoy_user.log";
|
final String logPath = new File(Config.getInstance().getHomeDirectory(), "log/envoy_user.log").getAbsolutePath();
|
||||||
new File(logPath).getParentFile().mkdirs();
|
new File(logPath).getParentFile().mkdirs();
|
||||||
|
|
||||||
SimpleFormatter formatter = new SimpleFormatter();
|
SimpleFormatter formatter = new SimpleFormatter();
|
||||||
|
Reference in New Issue
Block a user