Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
decebals committed Mar 20, 2019
1 parent e1fb3f7 commit f386054
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pf4j/src/main/java/org/pf4j/util/FileUtils.java
Expand Up @@ -77,7 +77,7 @@ public static void writeLines(Collection<String> lines, File file) throws IOExce
* @throws IOException if something goes wrong
*/
public static void delete(Path path) throws IOException {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
Files.walkFileTree(path, new SimpleFileVisitor<>() {

@Override
public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {
Expand Down Expand Up @@ -172,7 +172,8 @@ public static Path expandIfZip(Path filePath) throws IOException {

FileTime pluginZipDate = Files.getLastModifiedTime(filePath);
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) {
// do not overwrite an old version, remove it
Expand Down

0 comments on commit f386054

Please sign in to comment.