parent
c2f7bd7b21
commit
921f1f8689
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1 @@
|
||||
/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("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("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("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.
|
||||
*/
|
||||
private File themeFile = new File("themes.ser");
|
||||
private File themeFile = new File(Config.getInstance().getHomeDirectory(), "themes.ser");
|
||||
|
||||
/**
|
||||
* Singleton instance of this class.
|
||||
|
@ -1,6 +1,7 @@
|
||||
package envoy.client.ui;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -8,10 +9,7 @@ import java.util.logging.Logger;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import envoy.client.Client;
|
||||
import envoy.client.Config;
|
||||
import envoy.client.LocalDB;
|
||||
import envoy.client.Settings;
|
||||
import envoy.client.*;
|
||||
import envoy.client.util.EnvoyLog;
|
||||
import envoy.exception.EnvoyException;
|
||||
import envoy.schema.User;
|
||||
@ -62,8 +60,8 @@ public class Startup {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
EnvoyLog.setFileLevelBarrier(Config.getInstance().getFileLevelBarrier());
|
||||
EnvoyLog.setConsoleLevelBarrier(Config.getInstance().getConsoleLevelBarrier());
|
||||
EnvoyLog.setFileLevelBarrier(config.getFileLevelBarrier());
|
||||
EnvoyLog.setConsoleLevelBarrier(config.getConsoleLevelBarrier());
|
||||
|
||||
// Ask the user for their user name
|
||||
String userName = JOptionPane.showInputDialog("Please enter your username");
|
||||
@ -75,7 +73,7 @@ public class Startup {
|
||||
// Initialize the local database
|
||||
LocalDB localDB;
|
||||
try {
|
||||
localDB = new LocalDB(config.getLocalDB());
|
||||
localDB = new LocalDB(new File(config.getHomeDirectory(), config.getLocalDB().getPath()));
|
||||
} catch (IOException e3) {
|
||||
logger.log(Level.SEVERE, "Could not initialize local database", e3);
|
||||
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
|
||||
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();
|
||||
|
||||
SimpleFormatter formatter = new SimpleFormatter();
|
||||
|
Reference in New Issue
Block a user