OSDN Git Service

コンフィグパス生成のリファクタリング.
authoryuki <yuki@bdf3b611-c98c-6041-8292-703d9c9adbe7>
Sat, 16 May 2009 04:08:43 +0000 (04:08 +0000)
committeryuki <yuki@bdf3b611-c98c-6041-8292-703d9c9adbe7>
Sat, 16 May 2009 04:08:43 +0000 (04:08 +0000)
git-svn-id: http://192.168.11.7/svn/repository/NicoBrowserBranches/release_20090323/NicoBrowser@108 bdf3b611-c98c-6041-8292-703d9c9adbe7

src/nicobrowser/Config.java

index d8ea794..2966960 100644 (file)
@@ -13,26 +13,20 @@ public final class Config {
     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);
@@ -136,8 +130,8 @@ public final class 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(",");
     }