mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2025-09-02 11:36:59 +00:00
@ -6,8 +6,6 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -130,14 +128,15 @@ public class P {
|
||||
* 目录
|
||||
*/
|
||||
public static void saveFile(final String... dirs) {
|
||||
try {
|
||||
final URL url = instance.getClass().getClassLoader().getResource("plugin.yml");
|
||||
if (url == null) { return; }
|
||||
final String upath = url.getFile().substring(url.getFile().indexOf("/") + 1);
|
||||
final String jarPath = upath.substring(0, upath.indexOf('!'));
|
||||
JarFile jar = new JarFile(jarPath);
|
||||
final Enumeration<JarEntry> jes = jar.entries();
|
||||
for (JarEntry je = jes.nextElement(); jes.hasMoreElements();) {
|
||||
URL url = instance.getClass().getClassLoader().getResource("plugin.yml");
|
||||
if (url == null) { return; }
|
||||
String upath = url.getFile().substring(url.getFile().indexOf("/") + 1);
|
||||
String jarPath = upath.substring(0, upath.indexOf('!'));
|
||||
if (!new File(jarPath).exists()) {
|
||||
jarPath = "/" + jarPath;
|
||||
}
|
||||
try (JarFile jar = new JarFile(jarPath)) {
|
||||
jar.stream().forEach(je -> {
|
||||
if (!je.isDirectory()) {
|
||||
for (final String dir : dirs) {
|
||||
if (je.getName().startsWith(dir)) {
|
||||
@ -145,9 +144,9 @@ public class P {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
jar.close();
|
||||
} catch (IOException ignored) {
|
||||
});
|
||||
} catch (IOException e) {
|
||||
Log.d(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user