瀏覽代碼

Fix warning

tags/release-3.0.0
Decebal Suiu 5 年之前
父節點
當前提交
f38605432b
共有 1 個檔案被更改,包括 3 行新增2 行删除
  1. 3
    2
      pf4j/src/main/java/org/pf4j/util/FileUtils.java

+ 3
- 2
pf4j/src/main/java/org/pf4j/util/FileUtils.java 查看文件

* @throws IOException if something goes wrong * @throws IOException if something goes wrong
*/ */
public static void delete(Path path) throws IOException { public static void delete(Path path) throws IOException {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
Files.walkFileTree(path, new SimpleFileVisitor<>() {


@Override @Override
public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException { public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {


FileTime pluginZipDate = Files.getLastModifiedTime(filePath); FileTime pluginZipDate = Files.getLastModifiedTime(filePath);
String fileName = filePath.getFileName().toString(); String fileName = filePath.getFileName().toString();
Path pluginDirectory = filePath.resolveSibling(fileName.substring(0, fileName.lastIndexOf(".")));
String directoryName = fileName.substring(0, fileName.lastIndexOf("."));
Path pluginDirectory = filePath.resolveSibling(directoryName);


if (!Files.exists(pluginDirectory) || pluginZipDate.compareTo(Files.getLastModifiedTime(pluginDirectory)) > 0) { if (!Files.exists(pluginDirectory) || pluginZipDate.compareTo(Files.getLastModifiedTime(pluginDirectory)) > 0) {
// do not overwrite an old version, remove it // do not overwrite an old version, remove it

Loading…
取消
儲存