public static void loadProperties(String propsFile)
{
propertiesFile = propsFile;
+ String releasePropertiesFile = null;
+ boolean defaultProperties = false;
if (propsFile == null && !propsAreReadOnly)
{
+ String channelPrefsFilename = ChannelProperties
+ .getProperty("preferences.filename");
+ String releasePrefsFilename = ".jalview_properties";
propertiesFile = System.getProperty("user.home") + File.separatorChar
- + ".jalview_properties";
+ + channelPrefsFilename;
+ releasePropertiesFile = System.getProperty("user.home")
+ + File.separatorChar + releasePrefsFilename;
+ defaultProperties = true;
}
else
{
InputStream fis;
try
{
+ // props file provided as URL
fis = new URL(propertiesFile).openStream();
System.out.println(
"Loading jalview properties from : " + propertiesFile);
System.out.println(
"Disabling Jalview writing to user's local properties file.");
propsAreReadOnly = true;
-
} catch (Exception ex)
{
fis = null;
}
if (fis == null)
{
- fis = new FileInputStream(propertiesFile);
+ String readPropertiesFile = propertiesFile;
+ // if we're using the usual properties file and the channel properties
+ // file doesn't exist, read .jalview_properties
+ // (but we'll still save to the channel properties file).
+ if (defaultProperties && (!new File(propertiesFile).exists())
+ && (new File(releasePropertiesFile).exists()))
+ {
+ readPropertiesFile = releasePropertiesFile;
+ }
+ fis = new FileInputStream(readPropertiesFile);
}
applicationProperties.clear();
applicationProperties.load(fis);
defaultProps.put("uod_banner.32", "/default_images/UoD_banner-32.png");
defaultProps.put("default_appbase",
"https://www.jalview.org/getdown/release/1.8");
+ defaultProps.put("preferences.filename", ".jalview_properties");
// load channel_properties
Properties tryChannelProps = new Properties();
if (channelPropsURL == null)
{
// complete failure of channel_properties, set all properties to defaults
- System.err
- .println("Failed to find '" + CHANNEL_PROPERTIES_FILENAME
- + "' file at '"
- + (channelPropsURL == null ? "null"
- : channelPropsURL.toString())
- + "'. Using class defaultProps.");
+ System.err.println("Failed to find '" + CHANNEL_PROPERTIES_FILENAME
+ + "' file at '"
+ + (channelPropsURL == null ? "null"
+ : channelPropsURL.toString())
+ + "'. Using class defaultProps.");
tryChannelProps = defaultProps;
}
else
uod_banner.30=/images/UoD_banner-30.png
uod_banner.32=/images/UoD_banner-32.png
default_appbase=https://www.jalview.org/getdown/release/1.8
+preferences.filename=.jalview_properties
uod_banner.30=/images/UoD_banner-30.png
uod_banner.32=/images/UoD_banner-32.png
default_appbase=https://www.jalview.org/getdown/develop/11
+preferences.filename=.jalview_develop_properties
uod_banner.30=/images/UoD_banner-30.png
uod_banner.32=/images/UoD_banner-32.png
default_appbase=https://www.jalview.org/getdown/release/1.8
+preferences.filename=.jalview_properties
uod_banner.30=/images/UoD_banner-30.png
uod_banner.32=/images/UoD_banner-32.png
default_appbase=https://www.jalview.org/getdown/release/1.8
+preferences.filename=.jalview_properties
uod_banner.30=/images/UoD_banner-30.png
uod_banner.32=/images/UoD_banner-32.png
default_appbase=https://www.jalview.org/getdown/release/1.8
+preferences.filename=.jalview_properties