(String plugin, String currentVersion)
| 83 | } |
| 84 | |
| 85 | private void checkForUpdate(String plugin, String currentVersion) { |
| 86 | int slashIndex = plugin.lastIndexOf("/"); |
| 87 | if (slashIndex==-1 || !plugin.endsWith(".jar")) |
| 88 | return; |
| 89 | String className = plugin.substring(slashIndex+1, plugin.length()-4); |
| 90 | File f = new File(Prefs.getImageJDir()+"plugins"+File.separator+"jars"+File.separator+className+".jar"); |
| 91 | if (!f.exists() || !f.canWrite()) { |
| 92 | if (IJ.debugMode) IJ.log("checkForUpdate: jar not found ("+plugin+")"); |
| 93 | return; |
| 94 | } |
| 95 | String version = null; |
| 96 | try { |
| 97 | Class c = IJ.getClassLoader().loadClass("Compiler"); |
| 98 | version = "0.00a"; |
| 99 | Method m = c.getDeclaredMethod("getVersion", new Class[0]); |
| 100 | version = (String)m.invoke(null, new Object[0]); |
| 101 | } |
| 102 | catch (Exception e) {} |
| 103 | if (version==null) { |
| 104 | if (IJ.debugMode) IJ.log("checkForUpdate: class not found ("+className+")"); |
| 105 | return; |
| 106 | } |
| 107 | if (version.compareTo(currentVersion)>=0) { |
| 108 | if (IJ.debugMode) IJ.log("checkForUpdate: up to date ("+className+" "+version+")"); |
| 109 | return; |
| 110 | } |
| 111 | boolean ok = Macro_Runner.downloadJar(plugin); |
| 112 | if (IJ.debugMode) IJ.log("checkForUpdate: "+className+" "+version+" "+ok); |
| 113 | } |
| 114 | |
| 115 | boolean isJavac() { |
| 116 | if (compilerTool==null) |
no test coverage detected