This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new 1c7c64d Initialize current FS once.
1c7c64d is described below
commit 1c7c64dfd85974ebe9198940c8558730f442a851
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Sep 3 14:34:06 2021 -0400
Initialize current FS once.
---
src/main/java/org/apache/commons/io/FileSystem.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/io/FileSystem.java
b/src/main/java/org/apache/commons/io/FileSystem.java
index a4c386c..a983db1 100644
--- a/src/main/java/org/apache/commons/io/FileSystem.java
+++ b/src/main/java/org/apache/commons/io/FileSystem.java
@@ -125,11 +125,16 @@ public enum FileSystem {
private static final boolean IS_OS_WINDOWS =
getOsMatchesName(OS_NAME_WINDOWS_PREFIX);
/**
+ * The current FileSystem.
+ */
+ private static final FileSystem CURRENT = current();
+
+ /**
* Gets the current file system.
*
* @return the current file system
*/
- public static FileSystem getCurrent() {
+ private static FileSystem current() {
if (IS_OS_LINUX) {
return LINUX;
}
@@ -143,6 +148,15 @@ public enum FileSystem {
}
/**
+ * Gets the current file system.
+ *
+ * @return the current file system
+ */
+ public static FileSystem getCurrent() {
+ return CURRENT;
+ }
+
+ /**
* Decides if the operating system matches.
*
* @param osNamePrefix