MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getConfigurationFile

Method getConfigurationFile

ij/src/main/java/ij/Menus.java:1008–1023  ·  view source on GitHub ↗

Opens the configuration file ("plugins.config") from a JAR file and returns it as an InputStream.

(String jar)

Source from the content-addressed store, hash-verified

1006
1007 /** Opens the configuration file ("plugins.config") from a JAR file and returns it as an InputStream. */
1008 InputStream getConfigurationFile(String jar) {
1009 try {
1010 ZipFile jarFile = new ZipFile(jar);
1011 Enumeration entries = jarFile.entries();
1012 while (entries.hasMoreElements()) {
1013 ZipEntry entry = (ZipEntry) entries.nextElement();
1014 if (entry.getName().endsWith("plugins.config"))
1015 return jarFile.getInputStream(entry);
1016 }
1017 jarFile.close();
1018 }
1019 catch (Throwable e) {
1020 IJ.log(jar+": "+e);
1021 }
1022 return autoGenerateConfigFile(jar);
1023 }
1024
1025 /** Creates a configuration file for JAR/ZIP files that do not have one. */
1026 InputStream autoGenerateConfigFile(String jar) {

Callers 1

installJarPluginsMethod · 0.95

Calls 5

logMethod · 0.95
getNameMethod · 0.65
closeMethod · 0.65
getInputStreamMethod · 0.45

Tested by

no test coverage detected