private static Config instance;
private final Properties properties;
private final static String APPLICATION_NAME = "nicobrowser";
- private final static String DEF_CONFIG_PATH = "default";
private final static String CONFIG_NAME = APPLICATION_NAME + ".properties";
private Config() throws IOException {
- StringBuilder appHome = new StringBuilder(System.getProperty("user.home", "."));
- if (appHome.charAt(appHome.length() - 1) != File.separatorChar) {
- appHome.append(File.separator);
- }
- appHome.append("." + APPLICATION_NAME);
+ File appHome = new File(System.getProperty("user.home", "."), "." + APPLICATION_NAME);
- File appDir = new File(appHome.toString());
- if (!appDir.isDirectory()) {
- boolean result = appDir.mkdir();
+ if (!appHome.isDirectory()) {
+ boolean result = appHome.mkdir();
if (!result) {
throw new IOException("アプリケーションディレクトリ作成失敗");
}
- new File(appHome + File.separator + "flv").mkdir();
+ new File(appHome, "flv").mkdir();
}
- File config = new File(appHome + File.separator + CONFIG_NAME);
+ File config = new File(appHome, CONFIG_NAME);
Properties currentProperties = new Properties();
if (config.isFile()) {
InputStream is = new FileInputStream(config);
String res = properties.getProperty("download.number");
return Integer.parseInt(res);
}
-
- public String[] getDownLoadMyList(){
+
+ public String[] getDownLoadMyList() {
String res = properties.getProperty("download.mylist");
return res.split(",");
}