From 16dd06f1fc7d4d05b94f5193b34bf6e48eaebafb Mon Sep 17 00:00:00 2001 From: "pedemont%us.ibm.com" Date: Fri, 16 Dec 2005 22:30:03 +0000 Subject: [PATCH] Bug 320574 - Use new 'javaxpcom' GRE property for finding appropriate GRE. r=bsmedberg. git-svn-id: svn://10.0.0.236/trunk@186190 18797224-902f-48f8-a5cc-f745e15eee43 --- .../java/xpcom/interfaces/Mozilla.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/mozilla/extensions/java/xpcom/interfaces/Mozilla.java b/mozilla/extensions/java/xpcom/interfaces/Mozilla.java index 6978049c1b4..da4810ada0e 100644 --- a/mozilla/extensions/java/xpcom/interfaces/Mozilla.java +++ b/mozilla/extensions/java/xpcom/interfaces/Mozilla.java @@ -116,7 +116,13 @@ public class Mozilla implements IGRE, IXPCOM, IXPCOMError { return null; } - // search for GRE in platform specific locations + // Search for GRE in platform specific locations. We want a GRE that + // supports Java, so we look for the "javaxpcom" property by default. + if (aProperties == null) { + aProperties = new Properties(); + } + aProperties.setProperty("javaxpcom", "1"); + String osName = System.getProperty("os.name").toLowerCase(); if (osName.startsWith("mac os x")) { grePath = getGREPathMacOSX(aVersions); @@ -194,6 +200,9 @@ public class Mozilla implements IGRE, IXPCOM, IXPCOMError { File xpcomLib = new File(xulDir, "libxpcom.dylib"); if (xpcomLib.canRead()) { File grePath = xpcomLib.getCanonicalFile().getParentFile(); + + // Since GRE Properties aren't supported on Mac OS X, we check + // for the existence of the "javaxpcom.jar" file in the GRE. File jar = new File(grePath, JAVAXPCOM_JAR); if (jar.canRead()) { // found GRE @@ -224,6 +233,9 @@ public class Mozilla implements IGRE, IXPCOM, IXPCOMError { for (int i = 0; i < files.length; i++) { if (checkVersion(files[i].getName(), aVersions)) { File xpcomLib = new File(files[i], "libxpcom.dylib"); + + // Since GRE Properties aren't supported on Mac OS X, we check + // for the existence of the "javaxpcom.jar" file in the GRE. File jar = new File(files[i], JAVAXPCOM_JAR); if (xpcomLib.canRead() && jar.canRead()) { return files[i]; @@ -382,8 +394,7 @@ public class Mozilla implements IGRE, IXPCOM, IXPCOMError { File grePath = new File(pathStr); if (grePath.exists()) { File xpcomLib = new File(grePath, "xpcom.dll"); - File jar = new File(grePath, JAVAXPCOM_JAR); - if (xpcomLib.canRead() && jar.canRead()) { + if (xpcomLib.canRead()) { // found a good GRE return grePath; } @@ -499,8 +510,7 @@ public class Mozilla implements IGRE, IXPCOM, IXPCOMError { File grePath = new File(pathStr); if (grePath.exists()) { File xpcomLib = new File(grePath, "libxpcom.so"); - File jar = new File(grePath, JAVAXPCOM_JAR); - if (xpcomLib.canRead() && jar.canRead()) { + if (xpcomLib.canRead()) { // found a good GRE return grePath; }