From: <otm...@us...> - 2008-11-25 21:10:03
|
Revision: 5640 http://jython.svn.sourceforge.net/jython/?rev=5640&view=rev Author: otmarhumbel Date: 2008-11-25 21:09:57 +0000 (Tue, 25 Nov 2008) Log Message: ----------- check for both jython-complete.jar and jython.jar in findRoot() Modified Paths: -------------- trunk/jython/src/org/python/core/PySystemState.java Modified: trunk/jython/src/org/python/core/PySystemState.java =================================================================== --- trunk/jython/src/org/python/core/PySystemState.java 2008-11-25 14:11:53 UTC (rev 5639) +++ trunk/jython/src/org/python/core/PySystemState.java 2008-11-25 21:09:57 UTC (rev 5640) @@ -34,6 +34,7 @@ protected static final String CACHEDIR_DEFAULT_NAME = "cachedir"; public static final String JYTHON_JAR = "jython.jar"; + public static final String JYTHON_COMPLETE_JAR = "jython-complete.jar"; private static final String JAR_URL_PREFIX = "jar:file:"; private static final String JAR_SEPARATOR = "!"; @@ -392,10 +393,14 @@ if (root == null) { String classpath = preProperties.getProperty("java.class.path"); if (classpath != null) { - int jpy = classpath.toLowerCase().indexOf(JYTHON_JAR); - if (jpy >= 0) { - int start = classpath.lastIndexOf(java.io.File.pathSeparator, jpy) + 1; - root = classpath.substring(start, jpy); + String lowerCaseClasspath = classpath.toLowerCase(); + int jarIndex = lowerCaseClasspath.indexOf(JYTHON_COMPLETE_JAR); + if (jarIndex < 0) { + jarIndex = lowerCaseClasspath.indexOf(JYTHON_JAR); + } + if (jarIndex >= 0) { + int start = classpath.lastIndexOf(java.io.File.pathSeparator, jarIndex) + 1; + root = classpath.substring(start, jarIndex); } else { // in case JYTHON_JAR is referenced from a MANIFEST inside another jar on the classpath root = jarFileName; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |