|
@@ -22,10 +22,9 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.plugins;
|
24
|
24
|
|
25
|
|
-import com.dmdirc.util.resourcemanager.ResourceManager;
|
26
|
|
-
|
27
|
25
|
import java.io.IOException;
|
28
|
26
|
import java.net.URL;
|
|
27
|
+import java.nio.file.Files;
|
29
|
28
|
import java.util.ArrayList;
|
30
|
29
|
import java.util.Collections;
|
31
|
30
|
import java.util.Enumeration;
|
|
@@ -117,16 +116,10 @@ public class PluginClassLoader extends ClassLoader {
|
117
|
116
|
}
|
118
|
117
|
}
|
119
|
118
|
|
120
|
|
- final ResourceManager res;
|
121
|
|
- try {
|
122
|
|
- res = pluginInfo.getResourceManager();
|
123
|
|
- } catch (IOException ioe) {
|
124
|
|
- throw new ClassNotFoundException("Error with resourcemanager", ioe);
|
125
|
|
- }
|
126
|
|
-
|
127
|
119
|
final String fileName = name.replace('.', '/') + ".class";
|
128
|
120
|
try {
|
129
|
|
- if (pluginInfo.isPersistent(name) || !res.resourceExists(fileName)) {
|
|
121
|
+ if (pluginInfo.isPersistent(name) || !Files.exists(
|
|
122
|
+ pluginInfo.getPath(fileName))) {
|
130
|
123
|
if (!pluginInfo.isPersistent(name) && askGlobal) {
|
131
|
124
|
return globalLoader.loadClass(name);
|
132
|
125
|
} else {
|
|
@@ -152,8 +145,12 @@ public class PluginClassLoader extends ClassLoader {
|
152
|
145
|
|
153
|
146
|
// We are meant to be loading this one!
|
154
|
147
|
final byte[] data;
|
155
|
|
- if (res.resourceExists(fileName)) {
|
156
|
|
- data = res.getResourceBytes(fileName);
|
|
148
|
+ if (Files.exists(pluginInfo.getPath(fileName))) {
|
|
149
|
+ try {
|
|
150
|
+ data = Files.readAllBytes(pluginInfo.getPath(fileName));
|
|
151
|
+ } catch (IOException ex) {
|
|
152
|
+ throw new ClassNotFoundException(ex.getMessage(), ex);
|
|
153
|
+ }
|
157
|
154
|
} else {
|
158
|
155
|
throw new ClassNotFoundException("Resource '" + name + "' (wanted by " + pluginInfo.
|
159
|
156
|
getMetaData().getName() + ") does not exist.");
|
|
@@ -181,9 +178,7 @@ public class PluginClassLoader extends ClassLoader {
|
181
|
178
|
@Override
|
182
|
179
|
protected URL findResource(final String name) {
|
183
|
180
|
try {
|
184
|
|
- final ResourceManager res = pluginInfo.getResourceManager();
|
185
|
|
- final URL url = res.getResourceURL(name);
|
186
|
|
-
|
|
181
|
+ final URL url = pluginInfo.getPath(name).toUri().toURL();
|
187
|
182
|
if (url != null) {
|
188
|
183
|
return url;
|
189
|
184
|
}
|