public String getWritableDirectory() { String path; if (root.isJAR()) { String jarFile = getClassPathURL().getFile(); jarFile = jarFile.substring(jarFile.lastIndexOf('/') + 1, jarFile.length()); path = FileUtil.getRobotsDataDir().getPath(); if (jarFile.length() > 0) { path += File.separator + jarFile + '_'; } } else { path = ALWAYS_USE_CACHE_FOR_DATA ? FileUtil.getRobotsDataDir().getPath() : getClassPathURL().getFile(); } if (getFullPackage() != null) { path += File.separator + getFullPackage().replace('.', File.separatorChar); } return path; }
public String getReadableDirectory() { String path; if (root.isJAR()) { String jarFile = getClassPathURL().getFile(); jarFile = jarFile.substring(jarFile.lastIndexOf('/') + 1, jarFile.length()); path = FileUtil.getRobotsDataDir().getPath(); if (jarFile.length() > 0) { path += File.separator + jarFile + '_'; } } else { path = getClassPathURL().getFile(); } if (getFullPackage() != null) { path += File.separator + getFullPackage().replace('.', File.separatorChar); } return path; }
private void readJarStream(List<IRepositoryItem> repositoryItems, String root, JarInputStream jarIS) throws IOException { JarEntry entry = jarIS.getNextJarEntry(); while (entry != null) { String name = entry.getName().toLowerCase(); if (!entry.isDirectory()) { if (name.contains(".data/") && !name.contains(".robotcache/")) { JarExtractor.extractFile(FileUtil.getRobotsDataDir(), jarIS, entry); } else { if (name.endsWith(".jar") || name.endsWith(".zip")) { JarInputStream inner = null; try { inner = new JarInputStream(jarIS); readJarStream(repositoryItems, "jar:jar" + root + JarJar.SEPARATOR + entry.getName(), inner); } finally { if (inner != null) { inner.closeEntry(); } } } else { createItem(repositoryItems, new URL(root + "!/"), entry); } } } entry = jarIS.getNextJarEntry(); } }
public static void clean() { File roborumbleTempFile = new File("roborumble/temp"); deleteFile(roborumbleTempFile.getPath()); deleteFile(FileUtil.getRobotsDataDir().getPath()); deleteFile(FileUtil.getRobotDatabaseFile().getPath()); FileUtil.createDir(roborumbleTempFile); final IRepositoryManager repositoryManager = Container.getComponent(IRepositoryManager.class); repositoryManager.reload(true); Logger.logMessage("Cleaning done."); }