Compare commits
2 Commits
664c6108a5
...
8be9cf81d7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8be9cf81d7 | ||
|
|
7df22a2d1f |
@@ -47,14 +47,14 @@ public class Main {
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
List<String> fileNames = new ArrayList<>();
|
||||
URL jarUrl = classLoader.getResource("de/szimnau/zeitlaeufer");
|
||||
if (jarUrl == null) {
|
||||
throw new RuntimeException("Kann ausführbare Klassen nicht eruieren, da keine Ressource \"de/szimnau/zeitlaeufer\" verfügbar.");
|
||||
}
|
||||
String path = jarUrl.getPath().split(":", 2)[1];
|
||||
String cleanPath = path.substring(0, path.lastIndexOf('!'));
|
||||
Enumeration<JarEntry> entries;
|
||||
try (var jarFile = new JarFile(URLDecoder.decode(cleanPath, StandardCharsets.UTF_8))) {
|
||||
entries = jarFile.entries();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry entry = entries.nextElement();
|
||||
if (entry.isDirectory()) {
|
||||
@@ -62,6 +62,9 @@ public class Main {
|
||||
}
|
||||
fileNames.add(entry.getName());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Kann JAR-Datei zwecks Reflection nicht öffnen:", e);
|
||||
}
|
||||
var increment = new AtomicInteger();
|
||||
return Collections.unmodifiableSortedMap(new TreeMap<>(
|
||||
fileNames.stream()
|
||||
|
||||
Reference in New Issue
Block a user