From bff0d58937fcdb1f23522ce34439d83148c9dc8f Mon Sep 17 00:00:00 2001 From: yuki Date: Sat, 16 May 2009 20:21:17 +0000 Subject: [PATCH] =?utf8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF=E3=82=BF?= =?utf8?q?=E3=83=AA=E3=83=B3=E3=82=B0.=20File=E3=82=AF=E3=83=A9=E3=82=B9?= =?utf8?q?=E3=81=AE=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=82=92=E5=88=A9?= =?utf8?q?=E7=94=A8=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: http://192.168.11.7/svn/repository/NicoBrowserBranches/release_20090323/NicoBrowser@115 bdf3b611-c98c-6041-8292-703d9c9adbe7 --- src/nicobrowser/Config.java | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/nicobrowser/Config.java b/src/nicobrowser/Config.java index 57507ae..64ef8da 100644 --- a/src/nicobrowser/Config.java +++ b/src/nicobrowser/Config.java @@ -16,32 +16,33 @@ public final class Config { private static Config instance; private final Properties properties; private final static String APPLICATION_NAME = "nicobrowser"; - private final static String CONFIG_NAME = APPLICATION_NAME + ".properties"; + private final static String CONFIG_NAME = APPLICATION_NAME + ".xml"; + public final static File APP_HOME = new File(System.getProperty("user.home", "."), "." + APPLICATION_NAME); + public final static File CONFIG_FILE = new File(APP_HOME, CONFIG_NAME); + public final static File DEF_CONFIG_FILE = new File("resources/nicobrowser.xml"); private Config() throws IOException { - File appHome = new File(System.getProperty("user.home", "."), "." + APPLICATION_NAME); - if (!appHome.isDirectory()) { - boolean result = appHome.mkdir(); + if (!APP_HOME.isDirectory()) { + boolean result = APP_HOME.mkdir(); if (!result) { throw new IOException("アプリケーションディレクトリ作成失敗"); } - new File(appHome, "flv").mkdir(); + new File(APP_HOME, "flv").mkdir(); } - File config = new File(appHome, CONFIG_NAME); Properties currentProperties = new Properties(); - if (config.isFile()) { - InputStream is = new FileInputStream(config); + if (CONFIG_FILE.isFile()) { + InputStream is = new FileInputStream(CONFIG_FILE); currentProperties.load(is); is.close(); } else { - log.info("設定ファイルを新規作成: " + config.getCanonicalPath()); + log.info("設定ファイルを新規作成: " + CONFIG_FILE.getCanonicalPath()); } - properties = createNewProperties(currentProperties, appHome.toString()); + properties = createNewProperties(currentProperties, APP_HOME.toString()); - FileOutputStream fos = new FileOutputStream(config); + FileOutputStream fos = new FileOutputStream(CONFIG_FILE); properties.store(fos, APPLICATION_NAME + " (concept ver.) config file"); fos.close(); } -- 2.11.0