/** Default file is ~/.jalview_properties */
static String propertiesFile;
- private static boolean propsAreReadOnly = Platform.isJS();/// ** @j2sNative
- /// true || */false;
+ private static boolean propsAreReadOnly = Platform.isJS();
private final static String JS_PROPERTY_PREFIX = "jalview_";
}
// LOAD THE AUTHORS FROM THE authors.props file
- String authorDetails = (Platform.isJS() ? null
- : "jar:".concat(Cache.class.getProtectionDomain()
- .getCodeSource().getLocation().toString()
- .concat("!/authors.props")));
+ String authorDetails = resolveResourceURLFor("authors.props");
try
{
// FIND THE VERSION NUMBER AND BUILD DATE FROM jalview.jar
// MUST FOLLOW READING OF LOCAL PROPERTIES FILE AS THE
// VERSION MAY HAVE CHANGED SINCE LAST USING JALVIEW
- String buildDetails = (Platform.isJS() ? null
- : "jar:".concat(Cache.class.getProtectionDomain()
- .getCodeSource().getLocation().toString()
- .concat("!/.build_properties")));
+ String buildDetails = resolveResourceURLFor("/.build_properties");
+
if (buildDetails != null)
{
try
}
+ /**
+ * construct a resource URL for the given absolute resource pathname
+ *
+ * @param resourcePath
+ * @return
+ */
+ private static String resolveResourceURLFor(String resourcePath)
+ {
+ String url = null;
+ if (Platform.isJS() || !Cache.class.getProtectionDomain()
+ .getCodeSource().getLocation().toString().endsWith(".jar"))
+ {
+ try
+ {
+ url = Cache.class.getResource(resourcePath).toString();
+ } catch (Exception ex)
+ {
+
+ }
+ }
+ else
+ {
+ url = "jar:".concat(Cache.class.getProtectionDomain().getCodeSource()
+ .getLocation().toString().concat("!" + resourcePath));
+ }
+ return url;
+ }
+
private static void deleteBuildProperties()
{
applicationProperties.remove("LATEST_VERSION");
*/
public static String getProperty(String key)
{
- return applicationProperties.getProperty(key);
+ String prop = applicationProperties.getProperty(key);
+ if (prop == null && Platform.isJS())
+ {
+ prop = applicationProperties.getProperty(Platform.getUniqueAppletID()
+ + "_" + JS_PROPERTY_PREFIX + key);
+ }
+ return prop;
}
/**
}
}
- /**
- * Add a known domain that implements access-control-allow-origin:* bh 2018
- *
- * @param defaultUniprotDomain
- */
- public static void addJ2SDirectDatabaseCall(String domain)
- {
-
- /**
- * @j2sNative
- *
- * J2S.addDirectDatabaseCall(domain);
- */
- }
}