4 import java.io.FileInputStream;
5 import java.io.FileNotFoundException;
6 import java.io.IOException;
7 import java.util.Properties;
9 public class LaunchUtils
12 public static void loadChannelProps(File dir)
14 ChannelProperties.loadProps(dir);
17 private static Properties userPreferences = null;
19 public static String getUserPreference(String key)
21 if (userPreferences == null)
23 String channelPrefsFilename = ChannelProperties
24 .getProperty("preferences.filename");
25 if (channelPrefsFilename == null)
29 File propertiesFile = new File(System.getProperty("user.home"),
30 channelPrefsFilename);
31 if (!propertiesFile.exists())
37 userPreferences = new Properties();
38 userPreferences.load(new FileInputStream(propertiesFile));
39 } catch (FileNotFoundException e)
41 // didn't find user preferences file
43 } catch (IOException e)
45 System.err.println(e.getMessage());
49 return userPreferences.getProperty(key);
52 public static boolean getBooleanUserPreference(String key)
54 return Boolean.parseBoolean(getUserPreference(key));