From a01cd8ac5b0b73dfb1c7a43d24be261aa2f13405 Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Wed, 22 Apr 2020 07:11:58 +0300 Subject: [PATCH] Little optimization --- pf4j/src/main/java/org/pf4j/util/FileUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pf4j/src/main/java/org/pf4j/util/FileUtils.java b/pf4j/src/main/java/org/pf4j/util/FileUtils.java index 2a0ca85..7baaad4 100644 --- a/pf4j/src/main/java/org/pf4j/util/FileUtils.java +++ b/pf4j/src/main/java/org/pf4j/util/FileUtils.java @@ -46,6 +46,8 @@ public class FileUtils { private static final Logger log = LoggerFactory.getLogger(FileUtils.class); + private static final boolean IS_WINDOWS_OS = System.getProperty("os.name").startsWith("Windows"); + public static List readLines(Path path, boolean ignoreComments) throws IOException { File file = path.toFile(); if (!file.isFile()) { @@ -232,8 +234,7 @@ public class FileUtils { public static Path getPath(URI uri, String first, String... more) throws IOException { FileSystem fileSystem = getFileSystem(uri); Path path = fileSystem.getPath(first, more); - boolean isWindowsOS = System.getProperty("os.name").startsWith("Windows"); - if (isWindowsOS && "jar".equals(uri.getScheme())) { + if (IS_WINDOWS_OS && "jar".equals(uri.getScheme())) { // it's a ZipFileSystem fileSystem.close(); } -- 2.39.5