2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
24 import java.io.FileInputStream;
25 import java.io.FileNotFoundException;
26 import java.io.IOException;
27 import java.util.Properties;
29 public class LaunchUtils
32 public static void loadChannelProps(File dir)
34 ChannelProperties.loadProps(dir);
37 private static Properties userPreferences = null;
39 public static String getUserPreference(String key)
41 if (userPreferences == null)
43 String channelPrefsFilename = ChannelProperties
44 .getProperty("preferences.filename");
45 if (channelPrefsFilename == null)
49 File propertiesFile = new File(System.getProperty("user.home"),
50 channelPrefsFilename);
51 if (!propertiesFile.exists())
57 userPreferences = new Properties();
58 userPreferences.load(new FileInputStream(propertiesFile));
59 } catch (FileNotFoundException e)
61 // didn't find user preferences file
63 } catch (IOException e)
65 System.err.println(e.getMessage());
69 return userPreferences.getProperty(key);
72 public static boolean getBooleanUserPreference(String key)
74 return Boolean.parseBoolean(getUserPreference(key));