如果有更新标志,更新插件 @throws FileNotFoundException 找不到文件更新失败
()
| 104 | * @throws FileNotFoundException 找不到文件更新失败 |
| 105 | */ |
| 106 | private static void updatePlugins() throws FileNotFoundException { |
| 107 | File sign = new File("user/updatePlugin"); |
| 108 | if (!sign.exists()) { |
| 109 | return; |
| 110 | } |
| 111 | if (!sign.delete()) { |
| 112 | System.err.println("删除插件更新标志失败"); |
| 113 | } |
| 114 | File tmpPlugins = new File("tmp/pluginsUpdate"); |
| 115 | if (IsDebug.isDebug()) { |
| 116 | log.info("正在更新插件"); |
| 117 | } |
| 118 | File[] files = tmpPlugins.listFiles(); |
| 119 | if (files == null) { |
| 120 | return; |
| 121 | } |
| 122 | for (File eachPlugin : files) { |
| 123 | String pluginName = eachPlugin.getName(); |
| 124 | File targetPlugin = new File("plugins" + File.separator + pluginName); |
| 125 | FileUtil.copyFile(new FileInputStream(eachPlugin), targetPlugin); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | |
| 130 | /** |