Returns the attributes from the MANIFEST.MF file. @return attributes, or empty attribute list if the file is not found or cannot be parsed
()
| 216 | * @return attributes, or empty attribute list if the file is not found or cannot be parsed |
| 217 | */ |
| 218 | private static Attributes manifest() { |
| 219 | if(LOCATION != null) { |
| 220 | try { |
| 221 | final String jar = LOCATION.getFile(); |
| 222 | final ClassLoader cl = Prop.class.getClassLoader(); |
| 223 | for(final URL url : Collections.list(cl.getResources("META-INF/MANIFEST.MF"))) { |
| 224 | if(url.getFile().contains(jar)) { |
| 225 | try(InputStream in = url.openStream()) { |
| 226 | return new Manifest(in).getMainAttributes(); |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | } catch(final IOException ex) { |
| 231 | Util.stack(ex); |
| 232 | } |
| 233 | } |
| 234 | return new Attributes(0); |
| 235 | } |
| 236 | } |