diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2020-04-22 07:11:58 +0300 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2020-04-22 07:11:58 +0300 |
commit | a01cd8ac5b0b73dfb1c7a43d24be261aa2f13405 (patch) | |
tree | a7c4e83d098fbf077de03a98f88184e3c0a9ccb0 | |
parent | 01e42ee873f5b20c54744f21748fe2d2f28c0744 (diff) | |
download | pf4j-a01cd8ac5b0b73dfb1c7a43d24be261aa2f13405.tar.gz pf4j-a01cd8ac5b0b73dfb1c7a43d24be261aa2f13405.zip |
Little optimization
-rw-r--r-- | pf4j/src/main/java/org/pf4j/util/FileUtils.java | 5 |
1 files 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<String> 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(); } |