+ Properties bootstrapProps = new Properties();
+ File file = null;
+ if (filename != null)
+ {
+ file = new File(filename);
+ }
+ if (file == null || !file.exists())
+ {
+ if (file != null)
+ {
+ jalview.bin.Console
+ .errPrintln("Could not load bootstrap preferences file '"
+ + file.getPath() + "'");
+ }
+ String channelPrefsFilename = ChannelProperties
+ .getProperty("preferences.filename");
+ String propertiesFilename = System.getProperty("user.home")
+ + File.separatorChar + channelPrefsFilename;
+ jalview.bin.Console.errPrintln(
+ "Using default properties file '" + propertiesFilename + "'");
+ file = new File(propertiesFilename);
+ }
+ if (file == null || !file.exists())
+
+ {
+ String releasePrefsFilename = fallbackPropertiesFile;
+ String releasePropertiesFilename = System.getProperty("user.home")
+ + File.separatorChar + releasePrefsFilename;
+ jalview.bin.Console.errPrintln("Falling back to properties file '"
+ + releasePropertiesFilename + "'");
+ file = new File(releasePropertiesFilename);
+ }
+
+ if (!file.exists())
+ {
+ jalview.bin.Console
+ .errPrintln("Could not load bootstrap preferences file '"
+ + file.getPath() + "'");
+ return null;
+ }
+
+ try
+ {
+ FileInputStream in = new FileInputStream(file.getAbsoluteFile());
+ Properties props = new Properties();
+ props.load(in);
+ for (String prop : bootstrapProperties)
+ {
+ if (props.containsKey(prop))
+ bootstrapProps.put(prop, props.getProperty(prop));
+ }
+ } catch (FileNotFoundException e)
+ {
+ jalview.bin.Console
+ .errPrintln("Could not find bootstrap preferences file '"
+ + file.getAbsolutePath() + "'");
+ } catch (IOException e)
+ {
+ jalview.bin.Console.errPrintln(
+ "IOException when loading bootstrap preferences file '"
+ + file.getAbsolutePath() + "'");
+ }
+ return bootstrapProps;
+ }
+
+ public static void setSessionProperty(String key, String val)
+ {
+ if (key != null)
+ {
+ sessionProperties.put(key, val);
+ }