MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getDefaultJar

Method getDefaultJar

src/org/opensourcephysics/tools/Launcher.java:3817–3839  ·  view source on GitHub ↗

Gets the name of the jar containing the default launcher xml file, if any. @return the jar name

()

Source from the content-addressed store, hash-verified

3815 * @return the jar name
3816 */
3817 protected static String getDefaultJar() {
3818 URL url = ClassLoader.getSystemResource(defaultFileName + ".xset"); //$NON-NLS-1$
3819 if (url == null) {
3820 url = ClassLoader.getSystemResource(defaultFileName + ".xml"); //$NON-NLS-1$
3821 }
3822 if (url == null) {
3823 return null;
3824 }
3825 String path = url.getPath();
3826 // trim trailing slash and file name
3827 int i = path.indexOf("/" + defaultFileName); //$NON-NLS-1$
3828 if (i == -1) {
3829 return null;
3830 }
3831 path = path.substring(0, i);
3832 // jar name is followed by "!"
3833 i = path.lastIndexOf("!"); //$NON-NLS-1$
3834 if (i == -1) {
3835 return null;
3836 }
3837 // trim and return jar name
3838 return path.substring(path.lastIndexOf("/") + 1, i); //$NON-NLS-1$
3839 }
3840
3841 /**
3842 * Displays the properties of the specified node in an xml table inspector.

Callers 1

launchMethod · 0.95

Calls 1

getPathMethod · 0.45

Tested by

no test coverage detected