Initialize current FS once.
*/
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;
}
@@ -142,6 +147,15 @@ public static FileSystem getCurrent() {
return GENERIC;
}
+ /**
+ * Gets the current file system.
+ *
+ * @return the current file system
+ */
+ public static FileSystem getCurrent() {
+ return CURRENT;
+ }
+
/**
* Decides if the operating system matches.
*
