return libDir;
}
public Path ensureFile(String resource) {
Path f = new RelativePath(getPluginDirectory(), resource);
if (FileCommands.exists(f))
return f;
if (libTmpDir == null) {
try {
libTmpDir = FileCommands.newTempDir();
} catch (IOException e) {
e.printStackTrace();
}
}
f = new RelativePath(libTmpDir, resource);
f.getFile().getParentFile().mkdirs();
try {
InputStream in = this.getClass().getClassLoader().getResourceAsStream(resource);
if (in == null) {
Log.log.logErr("Could not load resource " + resource, Log.ALWAYS);
return new RelativePath(getPluginDirectory(), resource);
}
FileOutputStream fos = new FileOutputStream(f.getFile());
int len = -1;
byte[] bs = new byte[256];
while ((len = in.read(bs)) >= 0)
fos.write(bs, 0, len);
fos.close();